【瑞星系统】转移商品资料【1】


select * into aabasdept from (
select dptno,dptname,src,addtx,exctx,saltx,pid from [192.168.2.102].[scmis].[dbo].basdept) a


insert into basdept (dptno,dptname,src,addtx,exctx,saltx,pid)
select * from aabasdept

 

INSERT INTO   AABASPLUMAIN
SELECT PLUID,DPTID, PLUNO, PLUNAME, SPEC, PKUNIT, PKQTY, STKIT, SENDKIND
FROM [192.168.1.100].[scmis].[dbo].BASPLUMAIN


select * INTO  AABASPLUEXT
FROM (SELECT PLUID, COLOR, [SIZE], VALIDDAY, PROD, EXTNO, GSPEC, BFNAME, RSV, MAXQTY, MINQTY, SAFQTY
      FROM [192.168.1.100].[scmis].[dbo].BASPLUEXT) A

SELECT * into AABASPLUPRC
FROM (SELECT PLUID, NOTX, ADDTX, SALTX, EXCTX, SLPRC, PRCRAT, PROP, SI, VALID, VIPRAT, MAXSALQTY, OPNPRC, ZSLPRC, MSLPRC, PRICEOPT, MAXPRICE, MINPRICE, AVGCSPRC
      FROM [192.168.1.100].[scmis].[dbo].BASPLUPRC) A

SELECT * INTO AABASPLUDSC
FROM (SELECT PLUID, UPDATETIME, FLAG, XPBZ, STAT, BB, FILT
      FROM [192.168.1.100].[scmis].[dbo].BASPLUDSC ) A

SELECT * INTO AABASPLUBCD
FROM (SELECT PLUID, BCD, ANAME, CLASS, PROD
      FROM  [192.168.1.100].[scmis].[dbo].BASPLUBCD) A

DELETE FROM AABASPLUMAIN

insert into BASPLUMAIN(DPTID, PLUNO, PLUNAME, SPEC, PKUNIT, PKQTY, STKIT, SENDKIND)
SELECT * FROM AABASPLUMAIN

insert into BASPLUEXT(PLUID, COLOR, [SIZE], VALIDDAY, PROD, EXTNO, GSPEC, BFNAME, RSV, MAXQTY, MINQTY, SAFQTY)
SELECT C.PLUID,A.COLOR, A.[SIZE], A.VALIDDAY, A.PROD, A.EXTNO, A.GSPEC, A.BFNAME, A.RSV, A.MAXQTY, A.MINQTY, A.SAFQTY
FROM AABASPLUEXT A
LEFT JOIN AABASPLUMAIN B ON A.PLUID=B.PLUID
LEFT JOIN BASPLUMAIN  C ON B.PLUNO=C.PLUNO

insert into BASPLUPRC(PLUID, NOTX, ADDTX, SALTX, EXCTX, SLPRC, PRCRAT, PROP, SI, VALID, VIPRAT, MAXSALQTY, OPNPRC, ZSLPRC, MSLPRC, PRICEOPT, MAXPRICE, MINPRICE, AVGCSPRC)
SELECT C.PLUID, A.NOTX, A.ADDTX, A.SALTX, A.EXCTX, A.SLPRC, A.PRCRAT, A.PROP, A.SI, A.VALID, A.VIPRAT, A.MAXSALQTY, A.OPNPRC, A.ZSLPRC, A.MSLPRC, A.PRICEOPT, A.MAXPRICE, A.MINPRICE, A.AVGCSPRC
FROM AABASPLUPRC A
LEFT JOIN AABASPLUMAIN B ON A.PLUID=B.PLUID
LEFT JOIN BASPLUMAIN  C ON B.PLUNO=C.PLUNO

insert into BASPLUDSC (PLUID, UPDATETIME, FLAG, XPBZ, STAT, BB, FILT)
SELECT C.PLUID, A.UPDATETIME, A.FLAG, A.XPBZ, A.STAT, A.BB, A.FILT
FROM AABASPLUDSC A
LEFT JOIN AABASPLUMAIN B ON A.PLUID=B.PLUID
LEFT JOIN BASPLUMAIN  C ON B.PLUNO=C.PLUNO

insert into BASPLUBCD(PLUID, BCD, ANAME, CLASS, PROD )
SELECT C.PLUID, A.BCD, A.ANAME, A.CLASS, A.PROD
FROM AABASPLUBCD A
LEFT JOIN AABASPLUMAIN B ON A.PLUID=B.PLUID
LEFT JOIN BASPLUMAIN  C ON B.PLUNO=C.PLUNO

你可能感兴趣的:(系统)