INSERT AFTER或UPDATE AFTER内的回滚是否触发回滚整个事务 [英] Does a rollback inside a INSERT AFTER or UPDATE AFTER trigger rollback the entire transaction

查看:239
本文介绍了INSERT AFTER或UPDATE AFTER内的回滚是否触发回滚整个事务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在INSERT AFTER或UPDATE AFTER触发器内部进行回滚是回滚整个事务还是作为触发原因的当前行,是否与Commit进行回滚?

Does a rollback inside a INSERT AFTER or an UPDATE AFTER trigger rollback the entire transaction or just the current row that is the reason for trigger, and is it same with Commit ?

我试图通过当前使用MSTDC进行交易的项目代码进行检查,似乎整个交易都被中止了。

I tried to check it through my current projects code which uses MSTDC for transactions, and it appears as if though the complete transaction is aborted.

如果回滚到触发器确实回滚了整个事务,是否有一种变通方法可将其限制为仅当前行。

If a Rollback in the trigger does rollback the entire transaction, is there a workaround for to restrict it just the current rows.

我找到了 sybase 在此上,但是在SQL Server上什么也没有

I found a link for sybase on this, but nothing on sql server

推荐答案

是的,它将回滚整个事务。

Yes it will rollback the entire transaction.

全部在文档(请参阅备注)。请注意我强调的评论-这很重要!

It's all in the docs (see Remarks). Note the comment I've emphasised - that's pretty important I would say!!


如果在触发器中发出了ROLLBACK TRANSACTION:

If a ROLLBACK TRANSACTION is issued in a trigger:

当前事务
中对该点所做的所有数据修改都将回滚,包括由触发器进行的任何修改。

All data modifications made to that point in the current transaction are rolled back, including any made by the trigger.

触发器在
ROLLBACK语句之后继续执行所有剩余的语句
。如果其中任何一条语句修改了数据,则不会回滚
修改。这些剩余语句的
执行不会触发任何嵌套触发器。

The trigger continues executing any remaining statements after the ROLLBACK statement. If any of these statements modify data, the modifications are not rolled back. No nested triggers are fired by the execution of these remaining statements.

触发触发器
的语句之后的批处理语句不是

The statements in the batch after the statement that fired the trigger are not executed.

这篇关于INSERT AFTER或UPDATE AFTER内的回滚是否触发回滚整个事务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆