begin TRANSACTION;
declare @myError int = 0;
update prdt set prdt.up_xs=hs_tf.up/hs_tf.qty from prdt inner join hs_tf on prdt.prd_no= hs_tf.prd_no where hs_tf.hs_no='HS20220922001';
set @myError = @myError + @@ERROR;
update hs_mf set state='已审核' where hs_no='HS20220922001' and state='未审核';
set @myError = @myError + @@ERROR ;
update hs_tf set state='已审核' where hs_no='HS20220922001' and state='未审核';
set @myError = @myError + @@ERROR;
if @myError = 0
begin
commit transaction --提交事务
print '取款成功'
end
else
begin
rollback transaction --回滚到事务前
print '取款失败'
end