事务
程序员文章站
2022-05-12 21:29:16
...
begin transaction
declare @sumError int=0
update bank set balance=balance-1000 where cid='3'
set @[email protected][email protected]@ERROR
update bank set balance=balance+1000 where cid=1
SET @[email protected][email protected]@ERROR
if(@sumError<>0)
begin
rollback transaction
end
else
begin
commit transaction
end
上一篇: first flask blog