Search Suggest

Passing variables from a Parent Package To a Child - part II

Case
A few months ago I did a post on how to pass the value of a parent package to a child package. That solution consisted on a peace of .Net coding in a Script Task. But there is an other solution for those who don't like .Net coding.

Solution
This solution consists of using the package configuration.

1) Create parent variable
Create a variable in your parent package. Right click in the Control Flow if the variables are not visible. I used a string variable named FilePath in this test case to store some filepath.
Create new variable, think about the scope.












2) Create Execute Package Task
Drag an Execute Package Task in your Control Flow and configure it to start your child package.
Execute Package Task




















3) Create child variable
Goto to your child package and create a variable with the same name as your parent package variable.
Same name!













4) Add configurations
In the SSIS menu choose Package Configurations.
Package Configurations












5) Configuration Type
Enable package configuration(1) and add a configuration. Choose Parent package variable(2) and type the name of the variable(3).
Parent package variable



























6) Select Target Property
After you typed the name of the variable, hit the next button and select the value property of the child package variable. After that hit Next, Finish and OK to complete the configuration.
Value property of the child package variable

























7) Testing
To test the package I added a simple Script Task (sorry for .net coding) with a messagebox to show the value of the parent package.
Little bit of coding, but just for the show.




















The SSIS solution can be downloaded here.

Post a Comment