-- 升级发货通知单的辅助单位和辅助数量
IF  EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SM_DELIVERNOTICEENTRY' AND KSQL_COL_NAME ='FUNIT2NDID')
UPDATE T_SM_DELIVERNOTICEENTRY set FAUXUNITID = FUNIT2NDID where FAUXUNITID = 0 AND FUNIT2NDID <> 0;

IF  EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SM_DELIVERNOTICEENTRY' AND KSQL_COL_NAME ='FQTYUNIT2ND')
UPDATE T_SM_DELIVERNOTICEENTRY set FAUXQTY = FQTYUNIT2ND where FAUXQTY = 0 AND FQTYUNIT2ND <> 0;