none
execute sql task

    Question

  • hi

    in my execute sql task i need to update one field of table using user variable

    example.

    update temp1

    set id = ?

    i have declared my parameter .

    when i parse the query ,gives me error like 

    TITLE: SQL Task
    ------------------------------

    The query failed to parse. The batch could not be analyzed because of compile errors.

    ------------------------------
    BUTTONS:

    OK
    ------------------------------

    Tuesday, January 15, 2013 9:20 PM

Answers

  • Hi,

    this code cannot by parsed, because its not a valid TSQL code (due to ? character). Parse button is usable only for pure TSQL without parameters.

    Just Try to run this task and post only error information if there will be some.

    Zdenek


    Please mark as helpful and propose as answer if you find this as correct. nosekz.eu



    Tuesday, January 15, 2013 9:31 PM
  • Hi,

    you can use "Expression Tab" In Execute Query Task to use your variable and this will work perfectly fine. You can declare a user variable and then use that user variable in Expression Tab.

    • Proposed as answer by Ved_Prakash_ Wednesday, January 16, 2013 2:55 PM
    • Marked as answer by Eileen Zhao Thursday, January 24, 2013 2:18 AM
    Tuesday, January 15, 2013 11:33 PM

All replies

  • Hi,

    this code cannot by parsed, because its not a valid TSQL code (due to ? character). Parse button is usable only for pure TSQL without parameters.

    Just Try to run this task and post only error information if there will be some.

    Zdenek


    Please mark as helpful and propose as answer if you find this as correct. nosekz.eu



    Tuesday, January 15, 2013 9:31 PM
  • Hi,

    you can use "Expression Tab" In Execute Query Task to use your variable and this will work perfectly fine. You can declare a user variable and then use that user variable in Expression Tab.

    • Proposed as answer by Ved_Prakash_ Wednesday, January 16, 2013 2:55 PM
    • Marked as answer by Eileen Zhao Thursday, January 24, 2013 2:18 AM
    Tuesday, January 15, 2013 11:33 PM