Click here to Skip to main content
15,881,938 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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 = ?

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!
Posted

1 solution

1. First check SQL with some static ID
SQL
SELECT NAME FROM SCHDTASK
WHERE ID = 10

If you do not see any error on this continue to troubleshoot variable mappings.

First of all change result set to none, if any and verify the following.

If you are using OLDEB conn to SQL then parameter name can be 0, 1, 2 in order.
But if it's ADO.Net conn, specify the parameter name.

Refer : http://msdn.microsoft.com/en-us/library/cc280502.aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900