How to get rid of the deadlocks?

  • Hi,

    The problem I have, had been described in the pdf file I included.

    There is also additional file with sql script.

    If anyone of you could take a look at that I would be very grateful.

    Thanks for help in advance,

  • Switch traceflag 1222 on. That will result in a deadlock graph been written to the error log every time a deadlock occurs. Post the result of that graph here.

    DBCC TRACEON(1222,-1)

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Hey,

    Thanks for the answer.

    I set this flag and probably know what was wrong, however could you please tell me:

    1. In which isolation level the procedures like: AddNewRecord, UpdateRecord should operate on?

    2. Is such transaction safe in multithreaded environment? (like this included)

    update

    from

    where (not exists())

    I know that for example:

    if exists () begin

    update

    end else begin

    insert

    end

    is not safe, but what about "exists" which is in one "update" statement?

    Thanks!

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

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