SQL Server Performance

dead lock

Discussion in 'General DBA Questions' started by ranjandba, May 30, 2006.

  1. ranjandba New Member

    could u pls any one tell me how to reproduce a dead lock in sql server 2000
  2. FrankKalis Moderator

    Create a table named Table1 with a column named Field1. Put insome useless data and open 2 sessions in Query Analyzer

    Now in the first session issue a

    Begin Transaction
    Update Table1 set field1 = 'Value1'

    And in the second session

    Begin Transacation
    Update Table2 set field1 = 'Value2'
    Update Table1 set field1 = 'Value2'

    Now back to the first and

    Update Table2 set field1 = 'Value1'

    At that time you should have a deadlock.

    Frank Kalis
    Microsoft SQL Server MVP
    Heute schon gebloggt?http://www.insidesql.de/blogs
    Ich unterstuetze PASS Deutschland e.V. http://www.sqlpass.de)

Share This Page