all groups > sql server dts > february 2005 >
You're in the

sql server dts

group:

Execute Package Task and setting its inner Package Global Vaiables


Execute Package Task and setting its inner Package Global Vaiables ALI-R
2/18/2005 3:14:19 PM
sql server dts:
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

Re: Execute Package Task and setting its inner Package Global Vaiables ALI-R
2/19/2005 1:14:18 PM
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


[quoted text, click to view]

Re: Execute Package Task and setting its inner Package Global Vaiables ALI-R
2/19/2005 2:29:20 PM
[quoted text, click to view]

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
[quoted text, click to view]

Re: Execute Package Task and setting its inner Package Global Vaiables Allan Mitchell
2/19/2005 5:27:56 PM
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


[quoted text, click to view]

Re: Execute Package Task and setting its inner Package Global Vaiables Allan Mitchell
2/19/2005 10:02:29 PM
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 sheet).

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


[quoted text, click to view]

Re: Execute Package Task and setting its inner Package Global Vaiables Allan Mitchell
2/20/2005 8:12:47 AM
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


[quoted text, click to view]

Re: Execute Package Task and setting its inner Package Global Vaiables ALI-R
2/20/2005 10:17:01 AM
This is exactly what I am doing .I'm having two packages as follows:

1) Child Package (This package is called by Execute Package Task in the
parent package)
A) A global Variable called **Child_Var**
B) An Execute Sql Task which uses **Child_Var** to do something
dynamically (for instance inserting to a table)

2) Parent Package:
A) A gloabl variable called *Parent_Var*
B) An ActiveX script which sets *Parent_Var* to the inner Package global
variable of the Execute Package Task(which is **Child_Var** of the child
package)
C) A Execute Package Task (In which I'm using **Child_Var** as its
inner Package global variable )


I think for the above scenario ,I can't use Outter Global Variable.Right?

Is the above scenario makes sence?

Thanks very much for monitoring this thread.

Ali-R
[quoted text, click to view]

Re: Execute Package Task and setting its inner Package Global Vaiables ALI-R
2/20/2005 11:09:45 AM
Your humble opinion sounds great man.That's a better way of executing the
child package.

Thanks for your nice help.

[quoted text, click to view]
Re: Execute Package Task and setting its inner Package Global Vaiables Allan Mitchell
2/20/2005 6:31:05 PM
Ok So you want to retrieve the values of child package Global Variables and use them in you Parent as well as setting child global
variables from a parent package.

IMHO do not bother with the ExecutePackage task.

Call your package through the object model in the parent.

Pass and retrieve Global variables this way.

Execute a package from a package
(http://www.sqldts.com/default.aspx?215)



--

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


[quoted text, click to view]
Re: Execute Package Task and setting its inner Package Global Vaiables Kerry
3/3/2005 1:50:19 PM
Use it how?

I have a similar issue. I have an inner package that has an ExecuteSQL task
that accepts a date parameter which I have mapped to a global variable (in
the inner package) for test purposes I have set this value to '1/1/2005'
(without quotes of course). I want to set the value of this parameter from
the outer package. In the outer package I have created a global variable
and set its value to '2/1/2005'. When I run the execute package step (outer
package), '1/1/2005' is the value that is used by the inner package, not the
outer package value.

What am I doing wrong?

Kerry Carroll


[quoted text, click to view]
oCustomTask.GlobalVariables("TextFilePath_Child").Value=DTSGlobalVariables("
TextFilePath_Parent").Value
[quoted text, click to view]

Re: Execute Package Task and setting its inner Package Global Vaiables Kerry
3/3/2005 1:54:10 PM
"See" it how?

I have a similar issue. I have an inner package that has an ExecuteSQL task
that accepts a date parameter which I have mapped to a global variable (in
the inner package) for test purposes I have set this value to '1/1/2005'
(without quotes of course). I want to set the value of this parameter from
the outer package. In the outer package I have created a global variable
and set its value to '2/1/2005'. When I run the execute package step (outer
package), '1/1/2005' is the value that is used by the inner package, not the
outer package value.

What am I doing wrong?

Kerry Carroll

[quoted text, click to view]
oCustomTask.GlobalVariables("TextFilePath_Child").Value=DTSGlobalVariables("
TextFilePath_Parent").Value
[quoted text, click to view]

AddThis Social Bookmark Button