Monday, September 20, 2010

Passing variables in SSIS task to Script Task

I have set up a package with three String variables called
* FileName, which has a data type of String and an initial value of “Import.txt”
* FolderName, which has a data type of String and an initial value of “c:\”
* FullPath, which has a data type of String and no initial value
And a Script task.

I am executing this task in Sql Server 2008, which supports C# in script task. Sql Server 2005 does not support C# code it supports only VB.
One thing to note when you set up variables (choose SSIS-VARIABLES from the top menu) is to make sure you have clicked on the package and not a task when you create or add a variable. If you create a variable while being clicked on a task (therefore with task scope) then the variable will disappear from the list when you click up to the package.

The task I took is, I am storing the name of folder i.e. raghu in variable FolderName. I am assigning filename i.e. import.txt to the variable FileName. In the script task we are reading these two variables and concatenating the result to the third variable i.e. FullPath.

No comments:

Post a Comment