beigin tran //开始
declare @error1 int //设置变量接收异常
set @error1=0 //初始化为0
delete
set @error=@@error+@error1 //累加异常
delete
set @error=@@error+@error1 //累加异常
if @error<>0 //如果有异常 回滚
rollback tran
else
commit tran //否则提交
go
declare @error1 int //设置变量接收异常
set @error1=0 //初始化为0
delete
set @error=@@error+@error1 //累加异常
delete
set @error=@@error+@error1 //累加异常
if @error<>0 //如果有异常 回滚
rollback tran
else
commit tran //否则提交
go