Re: Execute Package Task and setting its inner Package Global Vaiables

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Allan Mitchell (allan_at_no-spam.sqldts.com)
Date: 02/20/05


Date: Sun, 20 Feb 2005 08:12:47 -0000

Then you have a couple of options

1. If you are using the ExecutePackage task then you can pass through a Parent package Global Variable to the child. The child
will then "See" this Global variable and its value and use it. You can pass a value to the Parent Package Global Variable using
DTSRUN and the /A switch

2. Use Active X Script. No real difference here you simply do not have a Gui. The advantage of this method is you can receive
Global variables values from the child package back in the parent. You set the value of the child Global Variables through code
assigning values to them from Parent package Global Variables and you set those by DTSRUN and the /A switch.

Make sene?

-- 
Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - SQL Server 2005 Integration Services.
www.Konesans.com
"ALI-R" <Ray@Alirezaei.com> wrote in message news:u55YwJtFFHA.2180@TK2MSFTNGP12.phx.gbl...
>> Outer global variables are used to pass a variable (and its value) from
>> the parent to the child.
>
> I have absolutely no idea how to use Outer global variables  to pass variable and its value to a child package ,currently  I'm 
> using this script in the parent to assign the package's global variable to the excute package task's inner global variable :
>
> Function Main()
>
> Set oPKG = DTSGlobalVariables.Parent
>  For Each oTask in oPKG.Tasks
>         'Test for Execute Package Task
>         If oTask.CustomTaskID = "DTSExecutePackageTask" Then
>             'Get CustomTask (DTS ExecutePackage Task) Object
>             Set oCustomTask = oTask.CustomTask
>             'Set new Inner Package Global Variable  value
>             oCustomTask.GlobalVariables("TextFilePath_Child").Value=DTSGlobalVariables("TextFilePath_Parent").Value
>         End If
>     Next
> Main = DTSTaskExecResult_Success
> End Function
>
> My problem was that I wanted not to use the script and use something else (like dynamic propert task)
> Here is what I want to do :
>
> 1) I'd like to pass a string (through "DTSRUN" command line ) to  my parent package
>
> 2)Then I'de like the parent package sends that string to the child package.
>
>
> Thanks
> "Allan Mitchell" <allan@no-spam.sqldts.com> wrote in message news:%23l1q$5sFFHA.2608@TK2MSFTNGP10.phx.gbl...
>> Outer global variables are used to pass a variable (and its value) from
>> the parent to the child.
>>
>> Inner global variables are used to assign a value to an existing
>> variable in the child, but the value is coded in the Exec Pkg Task, and
>> is not available in the parent.
>>
>>
>> It is most common to pass a variable and value from the parent to the
>> child. Inner variables are less frequently used, but still can be
>> useful.
>>
>>
>>
>> In the Execute Package task in the Dynamic Properties task.
>>
>> The only Global variables property you can set is the InnerGlobalVariables collection which in the task is the Outer Package 
>> Global Variables tab which is in turn the global variables in your calling package
>>
>> You can set what Global variable gets passed (You can set the value in the Global Variables properties ***).
>>
>> You do not have the ability as far as i can see through the dynamic properties task to set which Global Variable in the called 
>> package is being set.
>>
>>
>> Does this help?
>>
>> -- 
>>
>> Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
>> www.SQLDTS.com - The site for all your DTS needs.
>> www.SQLIS.com - SQL Server 2005 Integration Services.
>> www.Konesans.com
>>
>>
>> "ALI-R" <Ray@Alirezaei.com> wrote in message news:uj6J1fsFFHA.3648@TK2MSFTNGP10.phx.gbl...
>>> Thanks for your reply.
>>>
>>> If there is no such a functionality ,why when you place a Dynamic properties task  in your package and open it,in the section 
>>> for ExecutePackage task ,you can set its Inner Package golbal variable to whatever you want? I set it to the package's global 
>>> variable and I pass the package's global variable from command line(using dtsrun) ,but the problem is that this assignment 
>>> dosen't work:-)
>>>
>>> Ali-r
>>>
>>>
>>> "Allan Mitchell" <allan@no-spam.sqldts.com> wrote in message news:%23c4VlgqFFHA.936@TK2MSFTNGP12.phx.gbl...
>>>> If your question is
>>>>
>>>> "Can the Dynamic properties task reach inside my ExecutePackage task an grab something from there?"
>>>>
>>>> then the answer is unfortuntely not. (Or at least not as far as I know)
>>>>
>>>> -- 
>>>>
>>>> Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
>>>> www.SQLDTS.com - The site for all your DTS needs.
>>>> www.SQLIS.com - SQL Server 2005 Integration Services.
>>>> www.Konesans.com
>>>>
>>>>
>>>> "ALI-R" <newbie@microsoft.com> wrote in message news:%23gSMU%23gFFHA.3928@TK2MSFTNGP15.phx.gbl...
>>>>>I have an Execute Package which calls another package and passes its inner
>>>>> package global variable into the child package's global variable ,I have a
>>>>> global variavle in the master package which I like to set to execute package
>>>>> task's inner package global variable.I have done this by writing an script
>>>>> in the master package ,I was just wondering if I can do it thought Dynamic
>>>>> Properties task.I placed a dynamic property task in the master package and
>>>>> in the task section I assigned the innerGlobalVariable to the globalVariable
>>>>> of the package,but it dosen't pass the variable.
>>>>>
>>>>> Any idea? I appreciate it.
>>>>>
>>>>> Thanks
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
> 

Quantcast