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)
 begin transaction in update trigger

Author  Topic 

eddie
Starting Member

45 Posts

Posted - 2001-03-13 : 16:56:31
Hello, I have two triggers, an insert and update, with virtually the same code (the insert code just checks more things before the raiserror is fired) but when the update trigger is fired I get an error that it needs a begin transaction. Why would the update trigger require a begin transaction but the insert trigger not?

Begin
Declare @testcount int
select @TestCount = (select
count(*)
from
mytable mt, inserted
where
mt.object = '1' )



if (@TestCount = 0) begin
raiserror 30001 'Update not allowed.'
rollback transaction
return
end

Thanks,
Eddie

   

- Advertisement -