begin tran aaa1 declare @lvError int set @lvError=0 insert... set @lvError=@lvError+@@ERROR update... set @lvError=@lvError+@@ERROR delete... set @lvError=@lvError+@@ERROR if @@lvError>0 rollback tran aaa1 else commit tran aaa1
那么用set XACT_ABORT on 而不用判断@@error 会有问题吗? 我一直在这样用,还没有发现问题, 请问哪位高手使用过?
那么用set XACT_ABORT on 而不用判断@@error 会有问题吗? 我一直在这样用,还没有发现问题, 请问哪位高手使用过?
set XACT_ABORT on很好,我们公司(珠海远方财务)一直这样用, 我们是正版,有微软的技术支持。
XACT_ABORTSpecifies termination handling for the current procedure. Setting XACT_ABORT ON terminates the transaction if any error is encountered. If one statement raises an error, the entire transaction is terminated and rolled back. Setting XACT_ABORT option is set to OFF terminates only the SQL statement that raised the error. The transaction will continue.
declare
@lvError int
set @lvError=0 insert...
set @lvError=@lvError+@@ERROR
update...
set @lvError=@lvError+@@ERROR
delete...
set @lvError=@lvError+@@ERROR
if @@lvError>0
rollback tran aaa1
else
commit tran aaa1
会有问题吗?
我一直在这样用,还没有发现问题,
请问哪位高手使用过?
所以你用rollback只能是返回上一条正确insert,update,delete前的tran
会有问题吗?
我一直在这样用,还没有发现问题,
请问哪位高手使用过?
我们是正版,有微软的技术支持。
Setting XACT_ABORT ON terminates the transaction if any error is encountered. If one statement raises an error, the entire transaction is terminated and rolled back.
Setting XACT_ABORT option is set to OFF terminates only the SQL statement that raised the error. The transaction will continue.