SSIS Expressions setting two variables

LearnByReading picture LearnByReading · Jun 12, 2015 · Viewed 24.5k times · Source

I'm trying to use an "Expression Task" within SSIS to simply initialize/set two variables. This seemingly simple task has driven me nuts because I don't know how to separate the statements:

@[User::testVariable]="1"  
@[User::testVar2]=3

That gives a parsing error, and I've read through quite a lot of documentation to no avail. How are statements separated and I hope I don't have to use more than one expression task because I have a lot of variables... Thank you

Answer

Squ1rr3lz picture Squ1rr3lz · Jun 12, 2015

You can only set 1 variable at a time:

To change the value of a variable during runtime you need an expression or a Script Task. The expression isn't very flexible and the Script Task requires .Net knowledge. That's why Microsoft introduced the Expression Task in SSIS 2012. It enables you to set the value of one variable during runtime. Downside is that it isn't available for 2008 and you can only set one variable at a time.

http://microsoft-ssis.blogspot.com/2013/07/custom-ssis-component-multiple.html

You would have to download a customized Multiple Expressions Task component that is provided on the link or do a Expression Task for each variable.