Monday, 29 April 2013

For Loop task in SSIS Packages

Introduction

In this article we are going to see on how to use a For Loop container task in SSIS packaging. For loop task is the looping implementation of a task by which the task will evaluate an expression and loops through the process and until the evaluation goes to False. We will see through the steps on using this container and how to configure the properties associated with this task.
 

Steps

Follow steps 1 to 3 on 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 on how to use For Loop Container task options available with SSIS.
Once you created a project, just drag and drop the For Loop Container as shown in the below screen
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 through. See the below screen once we have inserted 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 which we are going to use in the loop process. To create a variable for to View à Other windows à Variable and assign values as shown in the below screen
Once we created the variable then 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 below screen. Once we execute the package we can see the data which is inserted.
Once the package is executed it will show as 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.

Conclusion

Conclusion goes here.

No comments:

Post a Comment