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)
 Rollback Transaction in trigger

Author  Topic 

sjb500
Starting Member

3 Posts

Posted - 2006-11-22 : 12:36:40
I have an AFTER trigger which responds to a table update process. Within this trigger a separate stored procedure is called which does some additional processing. The problem is that if this inner stored procedure fails, for whatever reason, the entire trigger and the initiating update also rollback whereas I want the update to commit.

I have tried using various combinations of SAVE TRANSACTION etc but each time I get messages similar to 'The current transaction cannot be committed and cannot be rolled back to a savepoint. Roll back the entire transaction.'

Does anyone have any ideas?

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-11-22 : 12:42:02
What if you start a new transaction before calling the inner SP?


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2006-11-22 : 15:08:31
a couple thoughts:

1) you could issue a "commit tran" in the trigger before you exec you inner sp

2) you could have your trigger save a row to a queue table. Then outside the context of your transaction process rows in your queue table. ie: from a job that runs every few seconds or something.

3)There are always exceptions but...typically, triggers that launch processes that cause problems indicate that the whole design could be re-vamped.

Be One with the Optimizer
TG
Go to Top of Page

sjb500
Starting Member

3 Posts

Posted - 2006-11-23 : 05:20:19
Thanks for the tips so far - food for thought.
Go to Top of Page
   

- Advertisement -