Inserting text data

  • Hi!

    Just created a table to hold the locks snapshots, used:

    EXEC sp_tableoption 'BLOCKS_HISTORY', 'text in row', 'on',

    to be able to insert text data into this table, but got an error for this code:

    ...

    UPDATE BLOCKS_HISTORY

    SET who_sql =

    (SELECT text FROM ::fn_get_sql(@who_sql_handle))

    WHERE (dt=@dt) and (who_sql_handle=@who_sql_handle)

    ...

    ---------------------------------------------------------

    Server: Msg 279, Level 16, State 3, Line 64

    The text, ntext, and image data types are invalid in this subquery or aggregate expression.

    What way can I insert text data from fn_get_sql function into my table?

  • Try syntax along the lines of:

     
    
    UPDATE BLOCKS_HISTORY
    set who_sql = text
    from BLOCKS_HISTORY, ::fn_get_sql(@who_sql_handle)
    WHERE (dt=@dt) and (who_sql_handle=@who_sql_handle)


    Cheers,
    - Mark

  • Worked!!!

    Thanks!

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

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