View Single Post
  #8 (permalink)  
Old March 31st, 2008, 06:45 PM
aleonard763 aleonard763 is offline
Wrox Author
 
Join Date: Sep 2007
Location: Farmville, VA, USA.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The Value in the Variables window may or may not update when you execute an Execute SQL Task and push a value into the variable.

If your goal is to determine that the variable is in fact being updated, add a Script Task to the Control Flow, connect the Execute SQL Task to it using a Success Precedence Constraint, and double-click to edit.

In ReadOnlyVariables, add the name of the variable. Click the Design Script button and add code similar to the following:

Dim iMyVar as Integer = Convert.ToInt32(Dts.Variables("MyVar").Value)
MsgBox(iMyVar.ToString)

This script task will display a messagebox with the value of the Variable named "MyVar". If you are successfully pushing a value into the variable, you will see this number change.

One way to test this is to substitute the call to the stored procedure in the SQLStatement property of the Execute SQL Task with T-SQL similar to the following: Select 42. If you see 42 in the messagebox, the variable value is changing.

Hope this helps.

:{> Andy Leonard

Andy Leonard
Reply With Quote