dbTalk Databases Forums  

send variable to another package

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


Discuss send variable to another package in the microsoft.public.sqlserver.dts forum.



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

Default send variable to another package - 10-25-2004 , 09:39 AM






Hi,
I have an ActiveX script as the following:
As you can see, it is calling another 14 DTS packages and How am I pass the
two GlobalVariables (gMonth and gYear) into those 14 DTS packages???
Thanks a lot

Ed

Function Main()

const DTSSQLStgFlag_UseTrustedConnection = 256
Dim myNum, gMonth, gYear
Dim myPackagename(13)

gMonth = Inputbox ("Please Enter the Month Number.")
gYear = Inputbox ("Please Enter the Year Number.")

DTSGlobalVariables("gMonth") = gMonth
DTSGlobalVariables("gYear") = gYear

myNum=0
myPackagename(0)="ImportMJERevenueMap_backup"
myPackagename(1)="ImportPayerRevenueMap_backup"
myPackagename(2)="ImportSoldToRevenueMap_backup"
myPackagename(3)="ImportRevenue_backup"
myPackagename(4)="ImportExpense_backup"
myPackagename(5)="ImportDepreciation_backup"
myPackagename(6)="ImportFSO_INST_backup"
myPackagename(7)="ImportFSO_MTCE_backup"
myPackagename(8)="ImportLease_backup"
myPackagename(9)="ImportNonTelco_backup"
myPackagename(10)="ImportOPSMetrics_backup"
myPackagename(11)="ImportOutTasking_backup"
myPackagename(12)="ImportProfitCenter_backup"
myPackagename(13)="ImportTelcoReport_backup"

Do While (myNum< 14)
'MsgBox "Begin process..." +myPackagename(myNum)
Set oPKG = CreateObject("DTS.Package")

oPKG.LoadFromSQLServer
"TXQ005DEV1","","",DTSSQLStgFlag_UseTrustedConnect ion,"","","",myPackagename(myNum)
oPKG.Execute
'MsgBox myPackagename(myNum)
oPKG.Uninitialize()
Set oPKG = Nothing
myNum = myNum + 1
Loop
Main = DTSTaskExecResult_Success
End Function

Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: send variable to another package - 10-25-2004 , 01:04 PM






OK

So you have a reference to the package.

You now need to go and set a value for the GlobalVariables collection on the
package object

From BOL

mk:@MSITStore:C:\Program%20Files\Microsoft%20SQL%2 0Server\80\Tools\Books\dtsprog.chm::/dtspcoll_6tgu.htm

--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.konesans.com - Consultancy from the people who know


"Ed" <Ed (AT) discussions (DOT) microsoft.com> wrote

Quote:
Hi,
I have an ActiveX script as the following:
As you can see, it is calling another 14 DTS packages and How am I pass
the
two GlobalVariables (gMonth and gYear) into those 14 DTS packages???
Thanks a lot

Ed

Function Main()

const DTSSQLStgFlag_UseTrustedConnection = 256
Dim myNum, gMonth, gYear
Dim myPackagename(13)

gMonth = Inputbox ("Please Enter the Month Number.")
gYear = Inputbox ("Please Enter the Year Number.")

DTSGlobalVariables("gMonth") = gMonth
DTSGlobalVariables("gYear") = gYear

myNum=0
myPackagename(0)="ImportMJERevenueMap_backup"
myPackagename(1)="ImportPayerRevenueMap_backup"
myPackagename(2)="ImportSoldToRevenueMap_backup"
myPackagename(3)="ImportRevenue_backup"
myPackagename(4)="ImportExpense_backup"
myPackagename(5)="ImportDepreciation_backup"
myPackagename(6)="ImportFSO_INST_backup"
myPackagename(7)="ImportFSO_MTCE_backup"
myPackagename(8)="ImportLease_backup"
myPackagename(9)="ImportNonTelco_backup"
myPackagename(10)="ImportOPSMetrics_backup"
myPackagename(11)="ImportOutTasking_backup"
myPackagename(12)="ImportProfitCenter_backup"
myPackagename(13)="ImportTelcoReport_backup"

Do While (myNum< 14)
'MsgBox "Begin process..." +myPackagename(myNum)
Set oPKG = CreateObject("DTS.Package")

oPKG.LoadFromSQLServer
"TXQ005DEV1","","",DTSSQLStgFlag_UseTrustedConnect ion,"","","",myPackagename(myNum)
oPKG.Execute
'MsgBox myPackagename(myNum)
oPKG.Uninitialize()
Set oPKG = Nothing
myNum = myNum + 1
Loop
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.