您的位置:首页 > 数据库

SQL 事务

2014-12-07 16:01 246 查看
/*========================事务==============================*/
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

事务:保证数据的一致性
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: