This procedure describes how to create a package configuration that uses the parent variable configuration type to enable a child package that is run from a parent package to access a variable in the parent.
It is not necessary to create the variable in the parent package before you create the package configuration in the child package. You can add the variable to the parent package at any time, but you must use the exact name of the parent variable in the package configuration. However, before you can create a parent variable configuration, there must be an existing variable in the child package that the configuration can update. For more information about adding and configuring variables, see How to: Add or Delete a Variable in a Package by Using the Variables Window.
The scope of the variable in the parent package that is used in a parent variable configuration can be set to the Execute Package task, to the container that has the task, or to the package. If multiple variables with the same name are defined in a package, the variable that is closest in scope to the Execute Package task is used. The closest scope to the Execute Package task is the task itself.
To add a variable to a parent package
- In Business Intelligence Development Studio, open the Integration Services project that contains the package to which you want to add a variable to pass to a child package.
- In Solution Explorer, double-click the package to open it.
- In SSIS Designer, to define the scope of the variable, do one of the following:
- To set the scope to the package, click anywhere on the design surface of the Control Flow tab.
- To set the scope to a parent container of the Execute Package task, click the container.
- To set the scope to the Execute Package task, click the task.
- Add and configure a variable.
Note Select a data type that is compatible with the data that the variable will store. - To save the updated package, click Save Selected Items on the File menu.
To add a variable to a child package
- In Business Intelligence Development Studio, open the Integration Services project that contains the package to which you want to add a parent variable configuration.
- In Solution Explorer, double-click the package to open it.
- In SSIS Designer, to set the scope to the package, click anywhere on the design surface of the Control Flow tab.
- Add and configure a variable.
Note Select a data type that is compatible with the data that the variable will store. - To save the updated package, click Save Selected Items on the File menu.
To add a parent package configuration to a child package
- If it is not already open, open the child package in Business Intelligence Development Studio.
- Click anywhere on the design surface of the Control Flow tab.
- On the SSIS menu, click Package Configurations.
- In the Package Configuration Organizer dialog box, select Enable package configuration, and then click Add.
- On the welcome page of the Package Configuration Wizard, click Next.
- On the Select Configuration Type page, in the Configuration type list, select Parent package variable and do one of the following:
- Select Specify configuration settings directly, and then in the Parent variable box, provide the name of the variable in the parent package to use in the configuration.
Important Variable names are case sensitive. - Select or Configuration location is stored in an environment variable, and then in the Environment variable list, select the environmentvariable that contains the name of the variable.
- Click Next.
- On the Select Target Property page, expand the Variable node, and expand the Properties node of the variable to configure, and then click the property to be set by the configuration.
- Click Next.
- On the Completing the Wizard page, optionally, modify the default name of the configuration and review the configuration information.
- Click Finish to complete the wizard and return to the Package Configuration Organizer dialog box.
- In the Package Configuration Organizer dialog box, the Configuration box lists the new configuration.
- Click Close.
No comments:
Post a Comment