/*发票明细数据升级  只把未同步的数据，进行同步*/
IF EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_INVOICEDETAIL') 
 INSERT INTO T_PUR_INVOICEDETAIL(FID,FENTRYID,FSEQ,FINVCODE,FINVNO,FINVDATE,FINVADDR,FINVSERIALNUM,FINVID) SELECT T0.FID,T0.FID,1,FInvoiceCode,FInvoiceNo,FInvoiceDate,finvaddress,fserialnum,FInvoiceID FROM T_PUR_INVOICE_A T0 LEFT JOIN T_PUR_INVOICEDETAIL T1 ON T0.FID = T1.FID WHERE T1.FID IS NULL;