July 22, 2009 at 2:05 pm
hello e1
I have a sequence of 9 steps, all execute sql tasks. In the sql statements of each step is a week end date that i change each week. I would like to have this as a package variable and change the value in one spot and run my package.
can this be done and if so could someone kindly guide me.
TYVM
peter
July 22, 2009 at 2:08 pm
Create a variable and write code in script task or expression builder to change it every week (or put the code in the the OnPreExecute event of the package)
July 22, 2009 at 2:21 pm
thanks
let me provide a few more specifics.
First, i'm a beginner but fast learner.
The nine steps would be something like this:
Step1(Execute SQL Task)
SELECT some date
From some table
WHERE MyDate = '01/01/01'
9 times soing 9 different operations. The 01/01/09 would remain the same. And change next week to 01/08/09.
I would like to do something like:
SELECT some date
From some table
WHERE MyDate = myVariable.
I created a package variable dtMyDate with a value but i can't figure out how to use it in each execute sql task.
July 22, 2009 at 2:33 pm
In the where clause use the variable substitution
SELECT some date
From some table
WHERE MyDate = ?
Under Parameter mapping in ExecuteSQLtask add a new parameter, take the approp data type, and for the ParameterName - select the one that u just created (Ex: User::ParamName)
July 22, 2009 at 2:43 pm
that is essentially what i have done.
i get an error message:
"the wrapper was unable to set the value of the variable specified in the executionvaluevariabel property."
July 22, 2009 at 2:57 pm
Did u set EvaluateAsExpression property = TRUE on the variable?
July 22, 2009 at 3:13 pm
I did not - so i just changed and got the same error message.
Let me recap exactly what i have - and oh by the way - much thanks for the help!!
created a variable - dtMyDate - Data Type DateTime Value 7/18/09
Execute Sql task - SQL Statement
Insert blah blah blah
Where WK_END_DT = ?
Parameter Mapping on that task
Variable Name User::dtMyDate Direction-Input
Data Type : DATE (i have tried DATE, DBDATE, DBTIME etc)
No Results Set
Variable property EvaluateasExpression now = TRUE
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply