标签:style blog color ar sp div on log bs
select * from bank insert into bank values(10000) insert into bank values(20000) --打开一个事务 begin tran --定义临时变量 declare @num int = 0; update bank set balance=balance-15000 where Id=1 set @num = @num + @@error; --上一条语句出错次数 update bank set balance=balance+15000 where Id=2 set @num = @num + @@error; if @num <> 0 begin --回滚事务 rollback tran end else begin --提交事务 commit tran end
标签:style blog color ar sp div on log bs
原文地址:http://www.cnblogs.com/han1982/p/4063734.html