SQL 事务


/*========================事务==============================*/
begin tran--开始事务
  --开始写流程语句
  --语句写完之后
if @@ERROR>0
rollback tran --回滚事务
else
commit tran--提交事务

-------------练习

 begin tran
 delete from Score where Sno=109
 delete from Student where Sno=105
 if @@ERROR>0
 begin
  rollback tran
 end
 else
 begin
  commit tran
 end
 select *from Score where109
 select *from Student


 
事务:保证数据的一致性

原文地址:https://www.cnblogs.com/2041388565m/p/4149500.html