Thursday, June 4, 2015

Working with For Loop Container in SSIS

Its is easy to use For Loop Container in SSIS. For Loop Container mainly used for execution of certain task for specified number of times that match the condition.We can use the for loop for updating big table and split updated in batches.

Here I have Shown a simple For Loop Task . Its prints from 0-9.
We declared three variables  as shown below. 

Start for Initial position .
Inc for Increment
End for condition satisfying until.


Double Click on ForLoop Container to Configure the For Loop Properties.

Set the properties as shown below.



In order to check whether the For Loop is Working Fine or Not I have used the Script Task to show the message box pop up. Script task is very useful to implement the custom functionality as well as useful for debugging.

Set the ReadOnlyVariables for the variable Start  to show that variables getting incremented by the for each loop logic.




 Click on Edit Script. 

Write the below code in main. 

MessageBox.Show(Dts.Variables[0].Value.ToString()


Save the script and Close the Editor. Build and Run the SSIS Package. Message Box prints from 0 to 9.






No comments: