dbTalk Databases Forums  

Execute Package

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Execute Package in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Joe
 
Posts: n/a

Default Execute Package - 01-12-2004 , 11:16 AM






Can someone assist in a code snippet showing how I can manipulate a Parent
DTS package from a child DTS package.

Example:
DTSPack1 calls DTSPack2. I want DTSPack2 to be able to change some of the
connection properties in DTSPack1 - so that when it returns to DTSPack1 it
will continue running with these new settings.

--
___________________________
Joe Horton
Database Developer / Software Engineer
WISHA/Legal Services Software Development
Department of Labor and Industries
Voice (360) 902-5928 fax (360) 902-6200



Reply With Quote
  #2  
Old   
Darren Green
 
Posts: n/a

Default Re: Execute Package - 01-12-2004 , 12:13 PM






In message <e51QH$S2DHA.2456 (AT) TK2MSFTNGP12 (DOT) phx.gbl>, Joe
<horj235 (AT) lni (DOT) wa.gov> writes
Quote:
Can someone assist in a code snippet showing how I can manipulate a Parent
DTS package from a child DTS package.

Example:
DTSPack1 calls DTSPack2. I want DTSPack2 to be able to change some of the
connection properties in DTSPack1 - so that when it returns to DTSPack1 it
will continue running with these new settings.

--
This article demonstrates how to load and execute a child package.

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

Any changes made to the child by the parent will only persist fro the
lifetime of the package object variable, declared as oPkg in the sample.
To persist this changes further you will need to call the
SaveToSQLServer method. Not sure why you would need to do this though.

--
Darren Green (SQL Server MVP)
DTS - http://www.sqldts.com

PASS - the definitive, global community for SQL Server professionals
http://www.sqlpass.org



Reply With Quote
  #3  
Old   
Joe
 
Posts: n/a

Default Re: Execute Package - 01-12-2004 , 12:41 PM



This is a more precise question - as I wasn't very clear on my problem:

Can anyone offer a code snippet that will allow me from a Child DTS Package,
modify settings on the Parent DTS package.

Example:
DTSPack1 calls DTSPack2. Within DTSPack2 some of the connection settings
inside DTSPack1 are changed. When DTSPack2 returns to DTSPack1 the adjusted
settings would be executed.

Below is a code snipped that changes a connection setting within the parent
package - but I want to execute this from a child package. So the first line
that refers to Set oPkg = DTSGlobalVariables.Parent I would think needs to
be changed to refer to the parent DTS package - but I can't figure it out:

' Get reference to current package
Set oPkg = DTSGlobalVariables.Parent
' Get Tasks collection
Set oTask = oPkg.Tasks
'Set up Connection
Set oConn = oPkg.Connections("PAC")
oConn.DataSource = oRS.Fields("SrcDSNName")
oConn.Password = oRS.Fields("SrcDSNPass")
oConn.UserID = oRS.Fields("SrcDSNUser")

"Darren Green" <darren.green (AT) reply-to-newsgroup-sqldts (DOT) com> wrote

Quote:
In message <e51QH$S2DHA.2456 (AT) TK2MSFTNGP12 (DOT) phx.gbl>, Joe
horj235 (AT) lni (DOT) wa.gov> writes
Can someone assist in a code snippet showing how I can manipulate a
Parent
DTS package from a child DTS package.

Example:
DTSPack1 calls DTSPack2. I want DTSPack2 to be able to change some of
the
connection properties in DTSPack1 - so that when it returns to DTSPack1
it
will continue running with these new settings.

--

This article demonstrates how to load and execute a child package.

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

Any changes made to the child by the parent will only persist fro the
lifetime of the package object variable, declared as oPkg in the sample.
To persist this changes further you will need to call the
SaveToSQLServer method. Not sure why you would need to do this though.

--
Darren Green (SQL Server MVP)
DTS - http://www.sqldts.com

PASS - the definitive, global community for SQL Server professionals
http://www.sqlpass.org




Reply With Quote
  #4  
Old   
Joe Horton
 
Posts: n/a

Default Re: Execute Package - 01-12-2004 , 12:44 PM



Here is my updated question - I'm actually trying to update the parent
package from the child package:

Can anyone offer a code snippet that will allow me from a Child DTS
Package, modify settings on the Parent DTS package.

Example:
DTSPack1 calls DTSPack2. Within DTSPack2 some of the connection
settings inside DTSPack1 are changed. When DTSPack2 returns to DTSPack1
the adjusted settings would be executed.

Below is a code snipped that changes a connection setting within the
parent package - but I want to execute this from a child package. So
the first line that refers to Set oPkg = DTSGlobalVariables.Parent I
would think needs to be changed to refer to the parent DTS package - but
I can't figure it out:

' Get reference to current package
Set oPkg = DTSGlobalVariables.Parent
' Get Tasks collection
Set oTask = oPkg.Tasks

'Set up Connection
Set oConn = oPkg.Connections("PAC")
oConn.DataSource = oRS.Fields("SrcDSNName")
oConn.Password = oRS.Fields("SrcDSNPass")
oConn.UserID = oRS.Fields("SrcDSNUser")


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Reply With Quote
  #5  
Old   
Darren Green
 
Posts: n/a

Default Re: Execute Package - 01-12-2004 , 03:19 PM



In message <1005qih9ki8db74 (AT) corp (DOT) supernews.com>, Joe
<nwservices (AT) olynet (DOT) com> writes
Quote:
This is a more precise question - as I wasn't very clear on my problem:

Can anyone offer a code snippet that will allow me from a Child DTS Package,
modify settings on the Parent DTS package.

Example:
DTSPack1 calls DTSPack2. Within DTSPack2 some of the connection settings
inside DTSPack1 are changed. When DTSPack2 returns to DTSPack1 the adjusted
settings would be executed.

Below is a code snipped that changes a connection setting within the parent
package - but I want to execute this from a child package. So the first line
that refers to Set oPkg = DTSGlobalVariables.Parent I would think needs to
be changed to refer to the parent DTS package - but I can't figure it out:

' Get reference to current package
Set oPkg = DTSGlobalVariables.Parent
' Get Tasks collection
Set oTask = oPkg.Tasks
'Set up Connection
Set oConn = oPkg.Connections("PAC")
oConn.DataSource = oRS.Fields("SrcDSNName")
oConn.Password = oRS.Fields("SrcDSNPass")
oConn.UserID = oRS.Fields("SrcDSNUser")

There is no way in the child package that you can gain access to the
current instance of the parent. In theory you could load parent, from
within the child, but obviously you would have to tell the child what
the parent is and how to find it, but this would not affect the instance
of the parent which loaded the child.

The move conventional method would be to use the child to set all the
data as global variable values, in the child, and then the parent can
read back the values after the Execute method.

--
Darren Green (SQL Server MVP)
DTS - http://www.sqldts.com

PASS - the definitive, global community for SQL Server professionals
http://www.sqlpass.org



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.