I have a script component which I need to reference a global variable? I guess I can dtsconfig file. How do I set this and read it back out from my script component?
views:
1205answers:
2
+1
A:
From http://blogs.conchango.com/jamiethomson/archive/2005/02/09/964.aspx :
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
Some more discussion:
Cade Roux
2009-01-21 14:16:45
+1
A:
You can use
Me.Variables.YourVariableName
this will work only in script component of Data Flow task. In script task you can use like this:
Dts.Variables("YourVariableName").Value.ToString
All you need is to configure the package variable in the dts config file by specifying the value.