March 17, 2010 at 11:11 pm
I am using an "execute SQL Task" with t-sql typed in directly. I pass in a single (date) variable that it used in two t-sql queries, like this:
select field 1.... from ... where date > ?
....
select field 2.... from ... where date > ?
When I run the package I get an error message. When I commented out either one of the queres (so "?" is active only once) the execute task ran successfully. Finally I passed in two input variables to the t-sql: Date1 and Date 2, both set to the
same date. Then the SSIS package ran fine and returned the expected results.
Originally I thought that passing in a single variable to the t-sql would cause all instances of "?" to be replaced by that value. Please clarify the situation for me.
TIA,
Barkingdog
March 18, 2010 at 5:38 am
I believe that in the Execute SQL Task, the ? are mapped to the variables regarding their ordinal position. Since SSIS can't know if you are using two distinct variables or one variable two times, he will generate an error.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
March 18, 2010 at 7:58 am
Map it twice, but it is mapped ordinally..
CEWII
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply