Search code examples
sql-serverssisssis-2008

SSIS loop over companies


I have a package SSIS for a company . Now I need to repeat the same work for 30 companies .

Company name

[Montreal$G_L_ entry]

[Dubai$G_L_ entry]

I would like like to loop over all companies . I get all the company names and put them in an ado record set. e.g.: SELECT DISTINCT CompanyName FROM YourTable in an execute sql task. create an ssis variable to hold the recordset .

How to make table name dynamic , I mean companyname$G_L_ entry and companyname will be changed dynamically ?


Solution

  • You need to use a Foreach container to iterate through the variable that holds the ADO recordset. That will assign each company name to a variable once each time through the loop. In the body of the loop container you do whatever tasks you want and us that variable as a parameter to the tasks.