您的位置:首页 > 其它

SET XACT_ABORT ON

2016-01-04 11:53 127 查看
Syntax

SET
XACT_ABORT { ON | OFF}


Remarks



When SET XACT_ABORT is ON, if a Transact-SQL statement raises a run-time error, the entire transaction is terminated and rolled back.

When SET XACT_ABORT is OFF, in some cases only the Transact-SQL statement that raised the error is rolled back and the transaction continues processing. Depending upon the severity of the error, the entire transaction may be rolled back even when SET XACT_ABORT
is OFF. OFF is the default setting.

Compile errors, such as syntax errors, are not affected by SET XACT_ABORT.

XACT_ABORT must be set ON for data modification statements in an implicit or explicit transaction against most OLE DB providers, including SQL Server. The only case where this option is not required is if the provider supports nested transactions.

When ANSI_WARNINGS=OFF, permissions violations cause transactions to abort.

The setting of SET XACT_ABORT is set at execute or run time and not at parse time.

目前理解:

set
xact_abort on, 事务失败all将rollback,

set
xact_abort off,事务失败只有失败的才会rollback.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: