常用SQL之:存储过程事务回滚

begin tran at01 begin try

----业务逻辑语句

commit tran at01 end try
begin catch
rollback tran at01
INSERT INTO t_log (ErrorMessage,ErrorSeverity,ErrorState,operator_type,operate_content,[operate_date])VALUES(ERROR_MESSAGE(),ERROR_SEVERITY(),ERROR_STATE(),'0','失败',GETDATE())
end catch

posted @ 2021-10-21 09:36  LoveMe7788  阅读(237)  评论(0编辑  收藏  举报