Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

How to assign a value to global variable Expand / Collapse
Author
Message
Posted Monday, November 24, 2008 2:51 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, January 26, 2011 7:15 AM
Points: 37, Visits: 158
Hi
I am using Script task to assign a value to global variable.I am trying in this way
Dts.Variables("gvRunDt").Value = RunDt
Dts.Variables("gvPdDt").Value = PdDt
Dts.Variables("gvFileName").Value = StrFile

Here gvRunDt,gvPdDt,gvFileName,gvFilename are global variables ......i want to assign the value in run time.............
Thanks in Advance...........
Post #607901
Posted Monday, November 24, 2008 3:04 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Monday, August 25, 2014 11:07 AM
Points: 226, Visits: 723
Make sure that you have specified these variables in the ReadWrite varible list under Script tab in Script Task Editor. The list should be comma seperated - e.g. gvRunDt,gvPdDt,gvFileName
Post #607909
Posted Monday, November 24, 2008 4:21 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, January 26, 2011 7:15 AM
Points: 37, Visits: 158
I did that But still i am unable to assign the values
Post #607947
Posted Monday, November 24, 2008 4:57 PM


SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Thursday, July 3, 2014 10:07 AM
Points: 434, Visits: 272
Maybe try this?

Imports Microsoft.SqlServer.Dts.Runtime

Public Class ScriptMain

Public Sub Main()

Dim vars As Variables

Dts.VariableDispenser.LockOneForWrite("vMyVar", vars)

vars(0).Value = "Hello World"

vars.Unlock()

Dts.TaskResult = Dts.Results.Success

End Sub

End Class


ZenDada
Post #607956
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse