定义事务transaction怎么定义事务

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/06 05:59:51

定义事务transaction怎么定义事务
定义事务transaction
怎么定义事务

定义事务transaction怎么定义事务
begin tran
if @zd_xh=-1
if @xgbz=1
begin
if exists(select 1 from YY_CONFIG where id="4026" and config="是")
begin
select a.cd_idm,sum(a.bssl*a.dwxs) as sl
into #count1
from #ypbstmp a
group by cd_idm
if @lb=0
begin
update YK_YKZKC
set djsl=djsl+b.sl
from YK_YKZKC a,#count1 b
where a.cd_idm=b.cd_idm
and a.ksdm=@ykdm
if @@error0
begin
select "F","出错!"
rollback transaction
return
end
end
end
end
begin tran …… end
这就是事务,……的部分将被统一执行,一旦没有全部执行成功则自动回滚.