--對采購為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