17 May 2008

SSIS: Passing parameters from parent to child package

When using “Execute Package Task” in SSIS control flow, you can’t pass in any configuration options or variables to the child package. Here is a workaround to do that:

  1. In the parent package, create a variable for each variable you want to set in child package. It must be defined as a global variable.
  2. In the child package, create variables to correspond to the ones you created in the Parent package (e.g. “ChildVar” to correspond to “ParentVar”). Important: assign these variables valid default values, otherwise you will not be able to run the child package standalone.
  3. In the child package, open the package Configurations. Add a new configuration, and select the “Parent package variable”. Enter the variable name you added to the parent package (in our example “ParentVar”). Note that variables are case sensitive. Assign this to the variable of the child package (”ChildVar”).

Now when you run the parent package, it will pass the value of the “ParentVar” to the “ChildVar”. When you run the child package directly (without a parent package), it will use the default value of the “ChildVar”.

2 comments: