April 18, 2019 at 5:33 am
Hi,
I'm experiencing a frustrating issue when trying to call a proc in an OLE DB source task. I'm using the SQL command from variable data access mode but I can see that it isn't evaluating my variable correctly.
My variable (with ValidateAsExpression set to True) uses an expression to create a sql command like "EXEC ProcName 'Param'" where the value of Param comes from a variable who's value I set using an EXEC SQL task. Below is the expression:
"EXEC ProcName " + "'" + @[User::vDateThreshold] + "'"
If I use a variable in my source that references a static value it works fine, but the issue seems to be when I use a variable which reference another variable in its expression.
Has anyone else come across this issue?
I'm using this method because I've had a similar issue when trying to use a parameter with the sql command data access method.
Thanks in advance
April 18, 2019 at 5:45 am
What is the data type of @[User::vDateThreshold]?
When you say: "I can see that it isn’t evaluating my variable correctly", what are you seeing, exactly\?
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
April 18, 2019 at 5:50 am
That variable uses the string data type.
I know the variable is being set as expected by the EXEC SQL task but my other string variable called vSQLString uses an expression that references vDateThreshold, and when I set my ole db source to use the vSQLString variable zero rows are passed in the data flow.
If I use a stand alone variable that has its value explicitly set to my SQL query and use this in the data flow it works as expected. It appears as though it doesn't like a variable that uses an expression to set its value.
i hope that makes sense.
April 18, 2019 at 6:30 am
Try setting a breakpoint after the ExecSQL task so that you can inpect the runtime contents of your vSQLString variable ... perhaps that will throw some light on what is happening.
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
April 18, 2019 at 6:35 am
<!--more-->I set a breakpoint at the postExec event of the exec sql task and the variable seemed to be set correctly.
I'll triple check that though.
April 18, 2019 at 6:40 am
Please check that both of the variables are being set correctly.
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
April 18, 2019 at 11:23 am
Thanks, Phil.
I again looked at the value of the variables and I noticed that the value for vDateThreshold was set incorrectly due to some ordering of the tasks. I just completely missed that when looking into the issue and everything is now working as expected.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply