dbTalk Databases Forums  

Passing variables to subpackages with ActiveX scripts in DTS

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


Discuss Passing variables to subpackages with ActiveX scripts in DTS in the microsoft.public.sqlserver.dts forum.



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

Default Passing variables to subpackages with ActiveX scripts in DTS - 10-21-2006 , 11:11 AM






I created a package which executes 15 other packages. Each of the inner
packages contains 3 variables which determine which files to load. Is there
a way to set these variables once on the main package and then have them
propagated to the sub packages programmatically? The main package contains
the following ActiveX script which sets the global variables. Is there a
way to reference the inner package from this ActiveX script using similar
code?

Function Main()
Dim oPKG
Set oPKG = DTSGlobalVariables.Parent
DTSGlobalVariables("gvHRActiveEmployees").Value = "Y"
DTSGlobalVariables("gvHRTermEmployees").Value = "Y"
DTSGlobalVariables("gvtblCorpStandards").Value = "N"
Main = DTSTaskExecResult_Success
End Function




Reply With Quote
  #2  
Old   
weelin
 
Posts: n/a

Default Re: Passing variables to subpackages with ActiveX scripts in DTS - 10-24-2006 , 12:52 PM






You can reference a child package and set variables within it like this

Dim lobjPackage
' Dim lobjStep

Set lobjPackage = CreateObject("DTS.Package")

'load DTS Package from SQL or storage file
' lobjPackage.LoadFromStorageFile "C:\MyPath\dts_child","","","",""
lobjPackage.LoadFromSQLServer "localhost", "", "",
DTSSQLStgFlag_UseTrustedConnection, "", "", "", "dts_child"


lobjPackage.GlobalVariables(1).Value = "localhost"
lobjPackage.GlobalVariables(2).Value = DTSGlobalVariables("your global
variable").Value

'execute DTS Package
lobjPackage.Execute


Weelin


On Oct 21, 5:11 pm, rmcompute <rmcomp... (AT) discussions (DOT) microsoft.com>
wrote:
Quote:
I created a package which executes 15 other packages. Each of the inner
packages contains 3 variables which determine which files to load. Is there
a way to set these variables once on the main package and then have them
propagated to the sub packages programmatically? The main package contains
the following ActiveX script which sets the global variables. Is there a
way to reference the inner package from this ActiveX script using similar
code?

Function Main()
Dim oPKG
Set oPKG = DTSGlobalVariables.Parent
DTSGlobalVariables("gvHRActiveEmployees").Value = "Y"
DTSGlobalVariables("gvHRTermEmployees").Value = "Y"
DTSGlobalVariables("gvtblCorpStandards").Value = "N"
Main = DTSTaskExecResult_Success
End Function


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

Default Re: Passing variables to subpackages with ActiveX scripts in DTS - 10-24-2006 , 05:41 PM



Thank you.

"weelin" wrote:

Quote:
You can reference a child package and set variables within it like this

Dim lobjPackage
' Dim lobjStep

Set lobjPackage = CreateObject("DTS.Package")

'load DTS Package from SQL or storage file
' lobjPackage.LoadFromStorageFile "C:\MyPath\dts_child","","","",""
lobjPackage.LoadFromSQLServer "localhost", "", "",
DTSSQLStgFlag_UseTrustedConnection, "", "", "", "dts_child"


lobjPackage.GlobalVariables(1).Value = "localhost"
lobjPackage.GlobalVariables(2).Value = DTSGlobalVariables("your global
variable").Value

'execute DTS Package
lobjPackage.Execute


Weelin


On Oct 21, 5:11 pm, rmcompute <rmcomp... (AT) discussions (DOT) microsoft.com
wrote:
I created a package which executes 15 other packages. Each of the inner
packages contains 3 variables which determine which files to load. Is there
a way to set these variables once on the main package and then have them
propagated to the sub packages programmatically? The main package contains
the following ActiveX script which sets the global variables. Is there a
way to reference the inner package from this ActiveX script using similar
code?

Function Main()
Dim oPKG
Set oPKG = DTSGlobalVariables.Parent
DTSGlobalVariables("gvHRActiveEmployees").Value = "Y"
DTSGlobalVariables("gvHRTermEmployees").Value = "Y"
DTSGlobalVariables("gvtblCorpStandards").Value = "N"
Main = DTSTaskExecResult_Success
End Function



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.