Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 shall this cause deadlock??

Author  Topic 

nishita_s
Yak Posting Veteran

61 Posts

Posted - 2008-12-16 : 03:39:37
update abcd
set id=a.abcdid
from abcd
join a on abcd.id=a.abcdid


update a
set abcdid=abcd.id
from a
join abcd on abcd.id=a.abcdid

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-12-16 : 03:43:55
nope. if executed like this as second update takes place only after first update is over.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-12-16 : 04:19:53
Are there triggers on the abcd or a tables?



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

nishita_s
Yak Posting Veteran

61 Posts

Posted - 2008-12-16 : 05:19:34
Tables
Go to Top of Page

nishita_s
Yak Posting Veteran

61 Posts

Posted - 2008-12-16 : 05:20:21
These two are tables only. i just wanted to ask why deadlock is not occured in this case?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-12-16 : 05:27:50
quote:
Originally posted by nishita_s

These two are tables only. i just wanted to ask why deadlock is not occured in this case?


what Peso is asking is whether you've any triggers created on tables which you've used in the query?
Go to Top of Page

nishita_s
Yak Posting Veteran

61 Posts

Posted - 2008-12-16 : 05:34:03
No trigger is there.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-12-16 : 06:00:51
How many users are running the updates simultaneously?



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

nishita_s
Yak Posting Veteran

61 Posts

Posted - 2008-12-16 : 06:16:19
3 users.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-12-16 : 06:41:41
Try using the updlock or rowlock for update statements.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

nishita_s
Yak Posting Veteran

61 Posts

Posted - 2008-12-16 : 22:35:35
No still its not showing deadlock error
Go to Top of Page
   

- Advertisement -