all groups > sql server programming > october 2007 >
You're in the

sql server programming

group:

After Insert trigger failure causes insert to fail


Re: After Insert trigger failure causes insert to fail Alex Kuznetsov
10/8/2007 1:38:31 PM
sql server programming: [quoted text, click to view]

that behavior is by design
Re: After Insert trigger failure causes insert to fail Aaron Bertrand [SQL Server MVP]
10/8/2007 5:01:37 PM
[quoted text, click to view]

An important component missing here is that it fires *before* the
transaction is committed. So, if there is a severe enough error in the
trigger, the transaction that caused the trigger to fire (e.g. the INSERT
statement) gets rolled back.

After Insert trigger failure causes insert to fail SWrobel
10/8/2007 8:31:35 PM
I have a table with an After Insert trigger on it, which I believe
means should only execute the trigger after the row has already been
inserted in the table, however when the trigger fails, the row does
not get inserted in the table. If it helps, the trigger is failing
because it is calling a function that doesn't exist). I have fixed
the problem, but was disturbed to find out that it was preventing
inserts.
Re: After Insert trigger failure causes insert to fail Alex Kuznetsov
10/9/2007 11:48:38 AM
[quoted text, click to view]

a _statement_ will fail. Regarding your transaction, there are
different ways of error handling. For instance, the following article
is very useful:

http://www.sommarskog.se/error-handling-II.html
Re: After Insert trigger failure causes insert to fail SWrobel
10/9/2007 6:17:40 PM
On Oct 8, 2:01 pm, "Aaron Bertrand [SQL Server MVP]"
[quoted text, click to view]

Thanks for the replies, Alex and Aaron. Are you both saying that
there is no way to force the transaction to commit even if the trigger
has a fatal error?
AddThis Social Bookmark Button