EXECUTE SQL TASK (DTS)

  • Hi All,

    I have an update command where i am using two tables to update the column of one table with the values of the other table.I want to pass a parameter to this command.But when i try to pass the parameter it gives me an error the col name not found.

    Here is the parameterised update command

    update A set col1=b.col1 from table1 a inner join table2 b on

    a.col1=b.col1 and a.col2=?

    could you please let me know on this

     

    Regards

    suresh

     

  • You are in effect creating dynamic sql by not declaring the table or column name in the statement.

    The ? paramater is to be used for values rather than table/column names.

    I don't think you are able to create dynamic sql using a paramater in a t/sql task as I have never tried. You need to create a variable to hold the sql statement and use exec to execute it.


    ------------------------------
    The Users are always right - when I'm not wrong!

  • not sure about this, but give this a try...

    enclose your current SQL string within

    sp_executesql( ... ) 

    -Mike Gercevich

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply