Solved

SSIS use database name as a parameter to sql task

Posted on 2011-09-06
4
592 Views
Last Modified: 2013-11-10
Creating an SSIS packege. Is it possible to create a sql task that runs a query that uses database name as a parameter?

example : Insert into mydb.ssis.mytable1
Values
(Select * from ?.prod.mytable1)

The parameter values should be coming from a user variable. Is that possible?

Thanks.
0
Comment
Question by:patd1
4 Comments
 
LVL 21

Expert Comment

by:huslayer
Comment Utility
Yes of course, sure
Just add Expressions in a variable and it will do.
0
 
LVL 8

Accepted Solution

by:
stalhw earned 500 total points
Comment Utility
dynamic SQL would do it...
declare @sqlquery varchar(4000)
SELECT @sqlquery='Select * from '+@yourvariable+'.prod.mytable1'
EXEC(@sqlquery)
0
 
LVL 22

Expert Comment

by:8080_Diver
Comment Utility
Or, perhaps, a better approach might be to use variables in the ConnectionManager for the Instance and catalog settings.
0
 
LVL 21

Expert Comment

by:Alpesh Patel
Comment Utility
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now