x

SSIS XML Data Source and variables

I have a datasource that needs to be created using variables but the "XML File from Variable" doesn't recognise the source when using the variables. If you hard code the path in the variable it works OK.

All ideas gratefully received.

The hardcoded path that works is:

d:\DropBox\In\AA.XMLProcessing

alt text

If this isn't possible does anyone have any workarounds?

Many thanks
Variables.jpg (21.0 kB)
more ▼

asked Apr 12, 2012 at 04:04 PM in Default

Mrs_Fatherjack gravatar image

Mrs_Fatherjack
4.7k 60 62 66

just a thought - variable scope is a pain in SSIS, are all the variable declared in the right places?
Apr 12, 2012 at 04:07 PM Fatherjack ♦♦
All variables in the package scope so should be OK. I've been burnt by that before. :)
Apr 12, 2012 at 04:10 PM Mrs_Fatherjack
(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first

You actually will need to build this as an expression within the property window of the "XMLSource" variable. Your expression should look like:

@[user::SourceDir] + "\\" + @[User::FileName] + ".XMLProcessing"

Then ensure you have the EvalueAsExpression property set to true for your "XMLSource" variable.
more ▼

answered Apr 12, 2012 at 04:40 PM

Shawn_Melton gravatar image

Shawn_Melton
5.4k 20 21 29

@Shawn Melton +1. This should do it. Although I have to edit your answer to show double backslashes (put 4 backslashes to make it work) :) The same way SSIS works ;)
Apr 13, 2012 at 06:27 AM Usman Butt
Awesome, that works perfectly. Many thanks.
Apr 13, 2012 at 07:35 AM Mrs_Fatherjack
(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x941
x150
x1

asked: Apr 12, 2012 at 04:04 PM

Seen: 2181 times

Last Updated: Apr 13, 2012 at 07:35 AM