June 29, 2010 at 8:08 am
I am trying to use a variable as an input in an 'Execute SQL Task'.
I pre-set my object outside the ForEach container. In the foreach container I set up all the Variable Mappings. I know all that is done correctly because when I use a Script Task to output these parameters to the screan it works.
But when I set up my 'Execute SQL Task' with one of these variables in the Variable Mappings as 'Input', with Parameter Name set to 0, and then have this simple script in the SQLStatement:
SELECT NAME FROM SCHDTASK
WHERE ID = ? --@Task_ID
I get an error when I run this.
"[Execute SQL Task] Error: Executing the query "SELECT NAME FROM SCHDTASK WHERE ID = ?" failed with the following error: "Syntax error, permission violation, or other nonspecific error". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
If anyone has any idea what I am doing wrong here, I would really appreciate any kind of input.
Thank you!
June 29, 2010 at 9:13 pm
I don't use SSIS so I have no clue but let my post serve as a "bump" to someone who may. 🙂
--Jeff Moden
Change is inevitable... Change for the better is not.
June 30, 2010 at 6:07 am
What are the datatypes of the variables?
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
June 30, 2010 at 7:41 am
The variable is an integer.
Looks like I figured it out though:
For 'Parameter Size' I put in 1 before. Now changed it to 3 and it works. No clue what exactly did it.
Thanks.
June 30, 2010 at 8:02 am
According to BOL, the parameter size is used for the following:
Parameter Size
Provide the size of parameters that have variable length, such as strings and binary fields.
This setting ensures that the provider allocates sufficient space for variable-length parameter values.
Usually I set this to -1.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply