Database Reference
In-Depth Information
er or variable from the master package to be stored in the child parameter. In the scen-
ario shown in Figure 16-2 , we are storing the name of the parent package in a paramet-
er in the child package, which we could then use to record the package that called the
child package.
If you want to test the package, you can create a Script task in the child package us-
ing the code shown in Listing 16-1 . Make sure to put the $Pack-
age::ParentPackageName parameter in the ReadOnlyVariables property.
If everything is mapped correctly, when you run the package, you should see the name
of the parent package in a message box, as shown in Figure 16-3 .
Listing 16-1 . Visual Basic Code to Display the Parent Package Name
Public Sub Main()
MsgBox("The name of the parent package is: " & _
Dts.Variables("$Package::ParentPackageName").Value.ToString)
Dts.TaskResult = ScriptResults.Success
End Sub
Figure 16-3 . Message box showing the name of the parent package
Now that you have a working parent-child package, let's take it to the next level by
creating a dynamic child package.
Dynamic Child Package Pattern
One of the nice things about Integration Services is the flexibility it provides if you
want to do something a little different. For example, if you are not sure exactly which
 
 
 
 
Search WWH ::




Custom Search