I can not create a deadlock

Giganews Newsgroups
Subject: I can not create a deadlock
Posted by:  Sn0tte…@yahoo.co.uk
Date: 3 Nov 2006

Which is normally a good thing but in this instance I need to do some
testing.

I have tried these two commands in two different Query Analysers, and
executing them both concurrently gives the expected dead lock.

BEGIN TRAN
update  sf_covernote  set uid = (select case uid WHEN 'uid1' THEN
'uid2' ELSE 'uid1' END from ai_inbox where doc_id = 265426) ;
WAITFOR DELAY '00:00:05';
update  ai_inbox  set uid = (select case uid WHEN 'uid1' THEN 'uid2'
ELSE 'uid1' END from ai_inbox where doc_id = 456012);
COMMIT TRAN

and

BEGIN TRAN
update  ai_inbox  set uid = (select case uid WHEN 'uid1' THEN 'uid2'
ELSE 'uid1' END from ai_inbox where doc_id = 456012);
WAITFOR DELAY '00:00:05';
update  sf_covernote  set uid = (select case uid WHEN 'uid1' THEN
'uid2' ELSE 'uid1' END from ai_inbox where doc_id = 265426);
COMMIT TRAN

You will have to trust me on the tables and fields but you should get
the idea.

Now I put these in two separate asp files and run them from two
different browsers logged in as two different users and I do not get a
deadlock.

Can anyone help?

Thanks
Wil

Replies