SSIS use database name as a parameter to sql task

Posted on 2011-09-06
Medium Priority
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
(Select * from ?.prod.mytable1)

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

Question by:patd1
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 21

Expert Comment

by:Jason Yousef, MS
ID: 36490928
Yes of course, sure
Just add Expressions in a variable and it will do.

Accepted Solution

stalhw earned 2000 total points
ID: 36490991
dynamic SQL would do it...
declare @sqlquery varchar(4000)
SELECT @sqlquery='Select * from '+@yourvariable+'.prod.mytable1'
LVL 22

Expert Comment

ID: 36491156
Or, perhaps, a better approach might be to use variables in the ConnectionManager for the Instance and catalog settings.
LVL 21

Expert Comment

by:Alpesh Patel
ID: 36493764

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have a large data set and a SSIS package. How can I load this file in multi threading?
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…
Suggested Courses

770 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