-
(help) Global Variables - DTS
Hi DTS Guru's,
--Code
declare @chvSQL varchar(4000)
set @chvSQL = 'DTSRUN /S MyServer /E /N test_MyDTSpackage /A "MyGlobalVariable":"8"="ABCDEFGH"'
exec master.dbo.xp_cmdshell @chvSQL
--Question
After executing my package, the global variable "MyGlobalVariable" does not seem to be passed to the actual package. The query & result looks fine, however after running that bit of code - I go back to the package and open the package properties only to find in the 'Global Properties' tab that the variable was not passed.
Can anyone help me with this? My aim is to pass a value to the package, which will then be written to a text file.
thanks in advance.
-
1. create global variable mytext
2. Create an Activex script task with the following code
Function Main()
Set FSO = CreateObject("Scripting.FileSystemObject")
TriggerFile ="C:\test.log"
Set FSOA = FSO.CreateTextFile(TriggerFile,2)
FSOA.writeline DTSGlobalVariables("mytext").Value
FSOA.writeline now()
Main = DTSTaskExecResult_Success
End Function
3. save dts package as test. execute the dts package using the following sql statement
in query analyzer
declare @chvSQL varchar(4000)
set @chvSQL = 'DTSRUN /Sservername /E /N test /A"mytext"="ABCDEFGH"'
exec master.dbo.xp_cmdshell @chvSQL
5. result of c:\test.log
ABCDEFGH
7/13/2005 8:09:56 AM
-
MAK! Your a CHAMP!
Golden Mate!
Thats Tops!
So in fact, there was nothing actually wrong with DTS at first attempt, just that I never used the variable.
MAK! Your the MAN!
Do you know if there is any major performance degradation in using Global Variables?
-
never heard of any performance degradation in using global variable
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|