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)
 Trigger / Deadlock

Author  Topic 

CGP
Starting Member

1 Post

Posted - 2008-06-09 : 05:36:50
Trigger / Deadlock

--------------------------------------------------------------------------------

Hello !

I've got two clients which make updates on the table Testtabelle.
In the Trigger of Testtabelle is only one select to the Testtabelle.

Why is this a deadlock ?

---------------------------------------------------------------
Process1-> update testtabelle set wert = 1 where id = 1

Process2-> update testtabelle set wert = 1 where id = 2

Trigger:
create trigger TriggerTesttabelle on testtabelle for update as
begin
select * from testtabelle;
end;
---------------------------------------------------------------

If I use a lock the result is the same: Deadlock

---------------------------------------------------------------
exec sp_getapplock 'ProcLock', 'Exclusive', 'session'
select * from testtabelle;
exec sp_releaseapplock 'ProcLock', 'session'
---------------------------------------------------------------

Probalbly it is a simple problem but I can't understand it.

Best regards,
Christina
   

- Advertisement -