replace function

  • I am doing some data conversion and am trying to clean up some data. I have a problem with a comments field that had pipes (||) entered into it instead of exlamation points (!!). To solve this I was just going to run this:

    Update tbl_docket set comments=replace(comments,'|','!')

    I'm getting the following error:

    Server: Msg 512, Level 16, State 1, Procedure update_status_chg_date, Line 6

    Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, = or when the subquery is used as an expression.

    The statement has been terminated

    What I find strange is I ran this code on a similar problem that effected multiple rows not long ago with no problems:

    update docfragment set filename = replace(filename, '!', ']')

  • It looks to me like you might have a trigger that does not properly handle multi-record updates. Check and see if the table that is the target of the UPDATE statement has a trigger. If so, have look and see if the trigger has the name of the procedure object listed in your error message. If so, then review the trigger.

  • Thanks, You were right, I looked right past that part of the error message. They had a trigger that updated a status change column for any updated row.

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

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