Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SSIS Package Creation

Author  Topic 

swheaton
Starting Member

1 Post

Posted - 2007-07-25 : 17:02:31
I am relatively new to this. I am trying to create a SSIS package that loops through several SQL tables. The first table is results_C01 and the last table is results_C18. They are in the same database. The number of tables will be increasing over time. I would like to perform a series of the same SQL tasks on these tables. My thought was to utilize a For Loop and imbed the SQL tasks within the For Loop. The SQL task would utilize a variable for the table name that would increment from results_C01 to results_C18 as it cycled through the For Loop.

I am able to create a For Loop with a variable, but I am not able to get the variable from the For Loop to equal and increment from results_C01 to results_C18. Secondly, I am not able to create an SQL task that utilizes a variable for a table name. I am really stuck.

nr
SQLTeam MVY

12543 Posts

Posted - 2007-07-25 : 19:30:13
>> create an SQL task that utilizes a variable for a table name
Use an expression.

>> I am not able to get the variable from the For Loop to equal and increment from results_C01 to results_C18. Secondly
Create a resultset, set it to a variable object and iterate over that.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -