'How can i pass database name dynamically in ssis execute sql task
In my server there are multiple databases. Hence having multiple connection manager for each db on server. Would like to pass database name as parameter in executesql task, so that I can reduce the no of connection managers. Something like below would be most preferable,
use ?
select * from tablename
Solution 1:[1]
You should be able to use multipart database naming conventions. the "use database" just changes the context of your connection. Choose the database that you use most frequently as a default then use the following:
select column1, column2 from databasename.schema.tablename
You can even use it across servers if you setup linked servers. (4-part naming)
select column1, column2 from linkedserver.databasename.schema.tablename
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Mike Munoz |