Monday, March 31, 2008

SSIS - Hello World! Part 2

This blog is part two of this: SSIS - Hello World! Part 1

In phase one of the Hello World SSIS package we setup a variable and then set up a script task to have it show us the value of our variable. More helpful than you might think. I use it all the time.

What's even more valuable though is setting the variable on the fly. This can easily be done with another script task - which is what we will do in this blog.

1) Start by renaming your task to something like "Msg Box" or "tell me my variable's value". Also, drag your task down a bit to make room for a task that will come right before it.







2) Pull another script task in from the toolbox, then click on the box to make the green arrow show up. Pull the green arrow and drop it onto the Msg Box task to connect the two in the Control Flow sequence.









3) Double-click to open the new script task. On the script tab set the "PrecompileScript..." property to False. Type the name of your Variable into the ReadWriteVariables property.







4) Click the "Design Script..." button and type in a line to set the variable to some other value. Like this:DTS.Variables("myVar").Value = "Hello Big, Bright, Beautiful World!!!"








5) Run your package to see it work.





No comments: