Table Name as a parameter on Execute SQL Task?

Is it not possible to have table name as a parameter For example have the SQL something like:

Delete From Where ID =

.. I get error:

[Execute SQL Task] Error: Executing the query "Delete From Where ID = " failed with the following error: "Must declare the table variable "@P1".". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.



Answer this question

Table Name as a parameter on Execute SQL Task?

  • njg

    Instead using a file connection as the source, use a variable (pointing to the one you set from the Script Task).



  • Maggie - Ebersold

    Thanks... maybe I should just make all my execute sql with a variable... certainly seems to be less troublesome :)
  • lowster11

    Have a variable - Update it dynamically with the TableName and form the query.
    Use that variable in SQL Task.

    Thanks,
    Loonysan


  • chiefmsb

    I have a same problem. I have one SCRIPT TASK and Execute SQL Task. I create the table name as a string in Script Task and pass this value to the Execute SQL Task. I have set the message box in the Script Task to see if the value is right. I have a sql source type as File Connection. The sql statement is DELETE FROM . The error message is same as the first comment in this thread. The error occured in the Execute SQL Task.

    What did I do wrong

  • Table Name as a parameter on Execute SQL Task?