SQL Server Integration Services (SSIS) – Part 12 – For Loop task in SSIS Packages

Karthikanbarasan
Posted by in Sql Server category on for Intermediate level | Points: 250 | Views : 13321 red flag
Rating: 5 out of 5  
 2 vote(s)

This is part 12 of the series of article on SSIS


 Download source code for SQL Server Integration Services (SSIS) – Part 12 – 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.

To follow my series of articles on SSIS packages refer to the below URL’s

SSIS Articles Part 1 to 11

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.

Page copy protected against web site content infringement by Copyscape

About the Author

Karthikanbarasan
Full Name: Karthikeyan Anbarasan
Member Level: Silver
Member Status: Member,Moderator,Microsoft_MVP,MVP
Member Since: 1/2/2011 3:00:14 AM
Country: India
Thanks Karthik www.f5Debug.net
www.f5Debug.net
www.f5Debug.net Around 5 years of experience in Microsoft technologies like ASP.Net, VB.Net, C#.net, SQL server, Biztalk Server, WCF, WPF, SSIS, SSRS, SSAS, AJAX and working as Senior Analyst in a US based MNC.

Login to vote for this post.

Comments or Responses

Login to post response

Comment using Facebook(Author doesn't get notification)