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 2000 Forums
 SQL Server Development (2000)
 how can run trigger update

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-05-20 : 23:01:37
betty writes "I have 2 trigger, trigger 1:
create trigger bill for insert as
declare @branch char(6),@code char(12)
update arblc set hist='2' where branch=@branch and docno=@code
return
trigger 2:
create trigger arblc for update as
declare @status char(1)
select @status=hist from inserted
if @status<>'2'
begin
if (select count(*) from inserted where hist='1')=0 and @status<>'2'
begin
aaaa (command calculate for rebalance table arblc)
end
end
return

Try run trigger 1 for give hist='2' as stop run trigger 2, but tihs happen trigger 2 do it proses calculate rebalance.
And this effect sql server appear message:
"General sql error
Deadlocked with another process and hasbeen chosen as a deadlock victim. Rerun your transaction."

How way to overcome this problem?

Note:
Table arblc have ex. 50 record/row and update 2 record/row with hist='2' at row 1 and 2.
And output debug, trigger 2 do proses rebalance at 3 row applied while column hist=''.

Thank's a lot.
Betty."
   

- Advertisement -