简体   繁体   中英

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 

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM