Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

how to Commit transaction even the trigger fails?

$
0
0

Hi Everyone,

I got a situation here, i have two tables and a trigger. A main table and a log table. Whenever  a change happens in the main transaction ,   a log details will be inserted into the log table.

Am using sql server 2000 and "For insert,update,delete" in one trigger. 

I am in need of commiting the original transaction even if the trigger fails. I mean the main table is so important for me, so all the transaction should commit in the main table no matter if some transactions details missed in the log table.

I tried with

begin try

-- statement

end try

begin catch

commit transaction

end catch.

But it doesnt works. My insert fails whenever the trigger fails. i want the transaction should continue even if the trigger fails...

Pls suggest me how to do it.. Thanx for your help



Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>