--对采购为1的明细屏蔽
update jh_rkmx set spid=replace(spid,'SPH','SPA') where spid in (select spid from spkfk where spmch like '%胶体果胶铋胶囊%') and hshj=1
update pf_ckmx set spid=replace(spid,'SPH','SPA') where pici in (select pici from fr_jh_rkmx20180304 where spid in (select spid from spkfk where spmch like '%胶体果胶铋胶囊%') and hshj=1)
update b set b.spid=replace(b.spid,'SPH','SPA') from fr_jh_rkmx20180304 a,spls_rk b where a.djbh=b.djbh and a.dj_sn=b.dj_sn
update b set b.spid=replace(b.spid,'SPH','SPA') from fr_pf_ckmx20180304 a,spls_ck b where a.djbh=b.djbh and a.dj_sn=b.dj_sn
--对两条重复记录屏蔽
update jh_rkmx set spid=replace(spid,'SPH','SPA') where djbh in ('JHCYMA00005703','JHAYMA00037099')
update spls_rk set spid=replace(spid,'SPH','SPA') where djbh in ('JHCYMA00005703','JHAYMA00037099')
update jh_rkhz set djbh=replace(djbh,'JHAY','JHYA') where djbh in ('JHCYMA00005703','JHAYMA00037099')
update jh_rkhz set djbh=replace(djbh,'JHCY','JHYC') where djbh in ('JHCYMA00005703','JHAYMA00037099')
--对调拨数据屏蔽
update spls_rk set spid=replace(spid,'SPH','SPA') where djbh in ('CDBYMA00056070')
update spls_ck set spid=replace(spid,'SPH','SPA') where djbh in ('CDBYMA00056070')
--一键恢复所有数据
update spls_rk set spid=replace(spid,'SPA','SPH') where spid not like 'sph%'
update spls_ck set spid=replace(spid,'SPA','SPH') where spid not like 'sph%'
update jh_rkmx set spid=replace(spid,'SPA','SPH') where spid not like 'sph%'
update pf_ckmx set spid=replace(spid,'SPA','SPH') where spid not like 'sph%'
update jh_rkhz set djbh=replace(djbh,'JHYA','JHAY') where djbh in ('JHCYMA00005703','JHYAMA00037099')
update jh_rkhz set djbh=replace(djbh,'JHYC','JHCY') where djbh in ('JHYCMA00005703','JHAYMA00037099')
本文转自 qvodnet 51CTO博客,原文链接:http://blog.51cto.com/bks2015/2084504