Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to change DBName in connstring dynamically

Status
Not open for further replies.

brookk

Programmer
Aug 24, 2011
1
US
Hello All,

I have to get database details for reach database on the server. In my SSIS package, I am already having a SQL task which get the dbnames in a result set. How do I dynamically change the dbname in connection string in my ForEach loop before it executes another SQL task which is database dependent.

Thanks much,
 
First you can create package variables of type string for the whole connection string, server name or just initial catalog properties (amongst others).

Modify the properties of the connection by expanding the 'expressions' and assigning your variable(s) to the property(s)

To update the variables dynamically you can use Dts.Variables within a script task .......

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top