dbTalk Databases Forums  

Re: Referencing a ssis system variable in a script task

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


Discuss Re: Referencing a ssis system variable in a script task in the microsoft.public.sqlserver.dts forum.



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

Default Re: Referencing a ssis system variable in a script task - 12-19-2006 , 01:34 PM






Hi,

I've never had to reference a system variable, but I have referenced
local variables by passing the variable into the script using the
supplied text box in the properties of the script object.

Hope this post helps.


Jay

vnapoli wrote:
Quote:
How does one reference a ssis system variable from inside a script task
object ( i.e. System::machinename)? Whenever I attempt it, I get an error
that it is unable to find the variable.


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

Default Re: Referencing a ssis system variable in a script task - 12-19-2006 , 01:36 PM






Ok so on the outside of the script task you have a box to enter names of
variables into a ReadOnly colllection. Is your variable listed there?

No matter, its better to do this inside the task anyway.

OK So let's say I want to grab the PackageName system variable
withinside the script task here is how I would go about doing it.



Public Sub Main()

Dim vs As Variables

Dts.VariableDispenser.LockOneForRead("System::Pack ageName", vs)

MsgBox(vs(0).Value.ToString())

vs.Unlock()

Dts.TaskResult = Dts.Results.Success
End Sub





--


Regards


Allan Mitchell
Konesans Ltd
T +44 7966 476 572
F +44 2071 008 479
http://www.konesans.com



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


Quote:
How does one reference a ssis system variable from inside a script task
object ( i.e. System::machinename)? Whenever I attempt it, I get an
error
that it is unable to find the variable.


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.