all groups > sql server dts > july 2007 >
You're in the

sql server dts

group:

passing variable in sql2005 package



passing variable in sql2005 package Daniel Vakil
7/20/2007 6:18:03 AM
sql server dts: hi, how can i get into the package the user.variable i passed by the command
line :

DTEXEC /SQL "\aaa\packages" /SERVER SQL2005SERVER /SET
"\Package.Variables[User::myvar].Properties[Value]";5849

i write this activeX script
a = Ctype(Dts.Variables.[User::myvar].Value, String) and also
a = Ctype(Dts.Variables.[User::myvar].Value, toString) and also
a = Ctype(Dts.Variables("User::myvar").Value, String)

Re: passing variable in sql2005 package Paul Ibison
7/21/2007 12:00:00 AM
In the script task, define myvar as a read only vairable to be passed into
the script. That way you can use DTS.Variables("myvar").Value to refer to
the variable's value.
HTH,
Paul Ibison

Re: passing variable in sql2005 package Daniel Vakil
7/21/2007 12:20:01 PM
hello Paul,

still i got this error when running the package with ssis

[ActiveX Script Task] Error: Retrieving the file name for a component failed
with error code 0x01AA3424.

the script include only this line ( for testing purpose )

MsgBox(Dts.Variables("myvariable").Value)

[quoted text, click to view]
Re: passing variable in sql2005 package Paul Ibison
7/23/2007 2:24:00 AM
I only just spotted that you are using the ActiveX script task. Is there any
reason for using this task instead of the the Script task - the ActiveX
script task is deprecated and exists only for backward compatibility and if
you use the Script task the solution for the variables issue is pretty
straightforward.
HTH,
Re: passing variable in sql2005 package Daniel Vakil
7/23/2007 10:06:01 AM
thanks Paul,
i changed the "dts.variables("myvariable").value"
to
"dtsglobalvariables("myvariable").value"
as in sql2000 and it works

where can i find a "visual basic script" guide ?


[quoted text, click to view]
Re: passing variable in sql2005 package Paul Ibison
7/24/2007 9:27:25 PM
I just picked it up from examples on the web and from Ken Henderson's book.
VB.NET in this context isn't that different to the use of VBScript, but
accessing the object model is different in SSIS and far more restrictive.
Cheers,
Paul Ibison

AddThis Social Bookmark Button