比如是sql server数据库
create proc YourProcName
@单据号 int
as
begin tran
delete B where 单据号=@单据号
and 单据号 in(select 单据号 from A where 单据号=@单据号 and 好/坏='坏')
if @@rowcount>0
delete A where 单据号=@单据号 and 好/坏='坏'
comm tran
create proc YourProcName
@单据号 int
as
begin tran
delete B where 单据号=@单据号
and 单据号 in(select 单据号 from A where 单据号=@单据号 and 好/坏='坏')
if @@rowcount>0
delete A where 单据号=@单据号 and 好/坏='坏'
comm tran
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货