Update gone mad

  • I have script that runs various but similar updates. The script has ran without incident a number of times just today it has been the following

    I get a 1 row updated for each record in the table and then at the end I get the total rows updated. Here's the statement

    UPDATE WORKSHEET

    SET REASON_CODE_5 = '0' WHERE

    REASON_CODE_5 IS NULL OR REASON_CODE_5 = ' '

    John Zacharkan


    John Zacharkan

  • Just a quick followup - this problem went away after the client was rebooted. Still have no idea what caused it, and would definitley be intersted in hearing from anyone who might have had a similar exp.

    tanks

    John Zacharkan


    John Zacharkan

  • Do you have SET NOCOUNT ON in your old script?

  • I guess this is a nice on where there is no functional need for NULL and a the (space) might be defaulted to (zero).

    Supposing there is a tablescan needed to perform this operation, how heavely used was your worksheet-table a executiontime of this query. During this scan operation you might have to wait to get access to pages/rows that are in use by other queries.

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • Just thought I'd point out that if you truly have reason codes = '' you could reduce your WHERE clause as follows:

    WHERE IsNull(REASON_CODE_5, '') = ''

Viewing 5 posts - 1 through 4 (of 4 total)

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