In this article we are going to see how to use a For Loop container task in SSIS packaging. A For loop task is the looping implementation of a task by which the task will evaluate an expression and loop through the process until the evaluation becomes False. We will see through the steps about using this container and how to configure the properties associated with this task.
Follow steps 1 to 3 in my first article to open the BIDS project and select the right project to work on integration services project. Once the project is created, we will see how to use the For Loop Container task options available with SSIS.
Once you have created a project, just drag and drop the For Loop Container as shown in the screen below.
Here I have placed an Execute SQL task to insert some records to a table. We are going to make use of the Loop container and insert to the table when it loops. See the screen below showing the result of inserting the Execute SQL task inside the for loop container.
Now we need to configure the For Loop Container; before proceeding we are going to set 2 variables that will be used in the loop process. To create a variable go to View --> Other windows --> Variable and assign values as shown in the screen below.
Once we have created the variable, go to the for loop container and double click it; it will open the container configuration as shown below. Just do the configuration as shown below.
Here we have given the count as 10 so it will loop through the process 10 times and insert the same record 10 times into the table. Here I have created a table like this and inserted a single record as shown in the screen below. Once we execute the package we can see the data that was is inserted.
Once the package is executed it will look as shown below:
To check if the Package is executed properly or not go to the query analyzer and we can see the result as below.
So we are good with the package execution process.