Saturday, April 21, 2012

For Loop Container - SSIS 2008

For Loop Container

Purpose: It loops to execute a task/set of task till a specified condition is true.
Eg : I am going to display a message using the for loop container and the script task (Easy oneJ)
Step1 : Define as user variable

Step2: Drag the For Loop Container from the ‘Control Flow’ tool bar
Step3: Define the For loop conditions

                InitExpression   : Define the initial Condition

                EvelExpression  : It is the condition by which the loop executes. The loop will occur till this condition is true

                AssignExpression : It defines what is to be done after executing each loop
            
Step4 : Drag the ‘Script Task’ into inside the For Loop container
Click the ‘Edit’ option and Click the ‘Edit Script’ option

Write the code to display the looping value as shown below
And compile the code to make sure no mistake made.

Now close the Script edit window and select the ‘loopcount’ variable in the ‘ReadOnlyVariables’ option of Script Task.


















Now Execute the Task.

We got we want

No comments: