开发者

Does an error thrown by an 'after insert/update' trigger cause the insert/update to fail?

If I have an AFTER INSERT, UPDATE trigger on a table, and the trigger fails (causes an error), will that cause the original INSERT or UPDATE to fail? I know the trigger happens after (hence the AFTER keyword), but does it abort the transaction (implicit or explicit), etc.?

Speci开发者_如何学JAVAfically regards SQL Server 2005, but I'm interested in info for 2000, 2005, and 2008. TIA.


Ah, found an article saying it does, at least in SQL Server 2000. Quoting:

You have trigger context when you are in a trigger, or you are in a stored procedure, user-defined function or block of dynamic SQL that has been called directly or indirectly from a trigger. That is, somewhere on the call stack, there is a trigger. If you are in trigger context, all errors terminate the batch and roll back the transaction on the spot.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜