question

Mrs_Fatherjack avatar image
Mrs_Fatherjack asked

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][1] [1]: http://ask.sqlservercentral.com/storage/temp/162-Variables.jpg If this isn't possible does anyone have any workarounds? Many thanks
ssisxmlsourcevariable
Variables.jpg (20.5 KiB)
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Fatherjack avatar image Fatherjack ♦♦ commented ·
just a thought - variable scope is a pain in SSIS, are all the variable declared in the right places?
0 Likes 0 ·
Mrs_Fatherjack avatar image Mrs_Fatherjack commented ·
All variables in the package scope so should be OK. I've been burnt by that before. :)
0 Likes 0 ·

1 Answer

·
Shawn_Melton avatar image
Shawn_Melton answered
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.
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Usman Butt avatar image Usman Butt commented ·
@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 ;)
1 Like 1 ·
Mrs_Fatherjack avatar image Mrs_Fatherjack commented ·
Awesome, that works perfectly. Many thanks.
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.