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:


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

avatar image

5.3k 66 69 77

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

avatar image

6.6k 21 26 34

@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.

Follow this question

By Email:

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



Answers and Comments

SQL Server Central

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



asked: Apr 12, 2012 at 04:04 PM

Seen: 3520 times

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

Copyright 2018 Redgate Software. Privacy Policy