October 5, 2010 at 3:58 pm
I need to get access to a package variable to use in the steps of my ssis package.
I have created the Variables as type String and a scope of the Package.
I have a SQL Task with a "Select 123456 as TRDATE" in the SQL Statement in the step.
In the Result Set section, I have "Result Name" --> TRDATE tied to USER::TRDATE
When I execute the step, no value appears in the Variable WIndow for USER::TRDATE
I must be missing a step somewhare.
Thanks
Jim
October 5, 2010 at 4:21 pm
Jim Covington (10/5/2010)
I need to get access to a package variable to use in the steps of my ssis package.I have created the Variables as type String and a scope of the Package.
I have a SQL Task with a "Select 123456 as TRDATE" in the SQL Statement in the step.
In the Result Set section, I have "Result Name" --> TRDATE tied to USER::TRDATE
When I execute the step, no value appears in the Variable WIndow for USER::TRDATE
I must be missing a step somewhare.
Thanks
Jim
I seem to remember needing to use the column position instead of the column name - try using 0 or 1 instead of TRDATE.
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
October 6, 2010 at 1:11 am
Just because you update a variable when your package executes does not mean that the value of the variable will be persisted in the Variables window afterwards.
Try putting a script task after your Execute SQL to display the value of the variable in a message box - something like this:
Public Sub Main()
MsgBox(Dts.Variables("User::TRDATE").Value)
Dts.TaskResult = ScriptResults.Success
End Sub
(remember to add User:TRDATE to the list of ReadOnlyVariables for the script task)
(remember also that (I think) TRDATE is case-sensitive)
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
October 6, 2010 at 8:20 am
Jim Covington (10/5/2010)
I need to get access to a package variable to use in the steps of my ssis package.I have created the Variables as type String and a scope of the Package.
I have a SQL Task with a "Select 123456 as TRDATE" in the SQL Statement in the step.
In the Result Set section, I have "Result Name" --> TRDATE tied to USER::TRDATE
When I execute the step, no value appears in the Variable WIndow for USER::TRDATE
I must be missing a step somewhare.
Thanks
Jim
What you're seeing is normal. I have never seen the value of the variable updated after the execution of the package.
Do what Phil said to check that the variable is updated during the execution, but don't expected that value to be retained after the execution is completed.
For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]
October 7, 2010 at 6:39 am
What you're seeing is normal. I have never seen the value of the variable updated after the execution of the package.
Neither have I, so I assume that's the expected behavior. When I need to know what variables were determined I write them out to a table.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply