How to set database name as a variable in SSIS?

Echo picture Echo · May 8, 2012 · Viewed 8.3k times · Source

In my current project, the database name keeps changing and I do not want to modify my OLE DB Sources each time. Thus I want to set it as a variable. That is, in each OLE DB Source, I could use it as a parameter. However, it seems SSIS doesn't allow database name to be transferred as a parameter. So what should I do to minimize my changes?

I wish to do something like this SQL statement in OLE DB Source:

Select OrderID
  From ?.Order

And I just need to modify my variable when the database name is changed. Thanks for any solutions!

Answer

Diego picture Diego · May 9, 2012

you need to add package configurations to your package and set the database name of the connection manager as one of the configurations

enter image description here

Just right click any blank area on the control flow and select "package configuration" and follow the wizard.

I Suggest you start with a XML configuration because its easier to understand.