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

sql server dts

group:

SSIS Variables Carry-Over Across Scope


SSIS Variables Carry-Over Across Scope Lawrence
4/27/2007 7:24:03 AM
sql server dts:
If I assign variable "LoopCount" in the ReadWriteVariables property of a
Script Task, it should carry over to the Loop Container Scope afterwards
right?

Here are the steps I am using.

1. In Script Task 1, assign
Dts.Variables("LoopCount").Value = 3

2. Assign variable "LoopCount" to ReadWriteVariables property

3. In Loop Container after Script Task 1, create Script Task 2, assign
call Dts.Variables("LoopCount").Value

This should output 3 instead of the default value, right?
Re: SSIS Variables Carry-Over Across Scope Allan Mitchell
4/30/2007 8:42:04 PM
Hello Lawrence,

Are the two tasks constrained by workflow? If they are not then yes I can
see why the value os the default value.

To test I have

Script Task 1--> On Success --> Script Task 2

In Script Task 1 I have

Public Sub Main()
'
Dim vs As Variables

Dts.VariableDispenser.LockOneForWrite("v", vs)

vs("v").Value = 999

vs.Unlock()


Dts.TaskResult = Dts.Results.Success

End Sub

In Script Task 2 I have

Public Sub Main()
'
Dim vs As Variables

Dts.VariableDispenser.LockOneForRead("v", vs)

MsgBox(vs("v").Value.ToString())


vs.Unlock()


Dts.TaskResult = Dts.Results.Success

End Sub


The value returned is 999

--

Allan Mitchell
http://wiki.sqlis.com | http://www.sqlis.com | http://www.sqldts.com |
http://www.konesans.com

[quoted text, click to view]

AddThis Social Bookmark Button