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
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 connect to multiple databases in Foreach loop

Author  Topic 

Dave_007
Starting Member

15 Posts

Posted - 2008-06-21 : 12:52:47
I have sql task inside a foreach loop which needs connection to multiple databases on different servers. I can pass the server name and the database name as a parameter. Can someone please tell me what steps to follow? Thanks in advance

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-21 : 13:57:06
Use For Each ADO enumerator and put the server and database names onto a table and take from table like this

http://www.codeproject.com/KB/database/foreachadossis.aspx

http://sqljunkies.com/WebLog/knight_reign/archive/2005/03/25/9588.aspx

or use ForEach item enumerator and form a collection with a list of servers and databases within it and map the collection to a varaible and then use the variable to map the source property of various connection managers.
Go to Top of Page

Dave_007
Starting Member

15 Posts

Posted - 2008-06-23 : 19:31:07
Thanks for information. Works great!!! :)
Go to Top of Page
   

- Advertisement -