RE: Passing values from child to parent package -
05-24-2004
, 03:36 PM
Here is an example that has worked in the past. Try and see if it works for
you:
In the parent package, you create an ActiveX script that is called before
the
Execute Package Task.
In the ActiveX Script, you include the following code to set one of the
Parents
Global Variables to the Parents Global Variable package.
Function Main()
Dim oPKG
Set oPKG = DTSGlobalVariables.Parent
Set DTSGlobalVariables("ParentVar").Value = oPKG
DTSGlobalVariables("TESTSTRING").Value = "Hello SQL SP"
Main = DTSTaskExecResult_Success
End Function
Then in the Execute Package Task, you pass the Variable to the child that
holds the
Parents Globabl Variable Package reference.
Then in the child package, you can use the following code to modify the
parent's
global variables in an ActiveX script.
This code assumes the parent has a globabl variable called TESTSTRING that
was not
passed to the child package.
Function Main()
Dim oParentPKG
Set oParentPKG = DTSGlobalVariables("ParentVar").Value
MSGBox(oParentPKG.GlobalVariables("TESTSTRING").Va lue)
oParentPKG.GlobalVariables("TESTSTRING").Value = "BYE SQL SP " ' set for
full
processing
Main = DTSTaskExecResult_Success
End Function
Rand
This posting is provided "as is" with no warranties and confers no rights. |