您的位置:首页 > 其它

商品单位关系与删除缺货登记

2015-01-20 11:02 197 查看
--/*******采购入库登记单位商品关系
if @djlxbs='116'
begin
create table #t_dwsp (
dwbh      char(11) null default '',
spid      char(11) null default '',
spid1     char(11) null default ''
)
insert into #t_dwsp(dwbh,spid,spid1)
select @dwbh,a.spid,isnull(b.spid,'@#$%^&*@#$%') as spid1 from #t_djmx a
left join wyf_dwspgx b(nolock) on a.spid=b.spid and b.dwbh=@dwbh

insert into wyf_dwspgx(dwbh,spid) select dwbh,spid from #t_dwsp where spid1='@#$%^&*@#$%'

drop table #t_dwsp
--删除缺货登记
insert into xsqhdj_his(rq,spid,shl,dwbh,username,beizhu) select rq,spid,shl,dwbh,username,beizhu from xsqhdj where spid in(select distinct spid from #t_djmx)
delete from xsqhdj where spid in(select distinct spid from #t_djmx)
end
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐