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
 Transact-SQL (2000)
 How many transaction could you have in a trigger?

Author  Topic 

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2004-11-27 : 15:04:21
hello,
I would like to know how many transactions you can have in a trigger and how many if statements could be nested in a trigger ?

e.g.

if @@error = 0
-- transaction 1
begin
--statements go here
end
else goto option1

-- transaction 2
if @@error <> '0'
begin
--statements go here
end
else goto option2

option1:
--statments

option2:
insert into error_table (msg)
values (@@error)

Would a trigger like this be ok ?



Afrika

scullee
Posting Yak Master

103 Posts

Posted - 2004-11-27 : 15:21:44
Cant see any reason why it wouldnt work.

You might have to watch performance if the table is hit a lot.
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2004-11-27 : 16:22:40
And don't cross post

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2004-11-28 : 07:43:46
thanks a lot, I didnt say it didnt work, am just asking if its an ok practice

since its my first time trying such a thing out

thanks
Go to Top of Page

slserra
Starting Member

19 Posts

Posted - 2005-11-15 : 16:58:00
Just testing the 'subscribe to a topic' email.
Go to Top of Page
   

- Advertisement -