/***签约方分录增加源单分录ID 分录来源字段**/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_CONTRACTPARTY' AND KSQL_COL_NAME IN ('FSRCPARTCENTRYID'))
ALTER TABLE T_ER_CONTRACTPARTY ADD (FSRCPARTCENTRYID BIGINT DEFAULT 0 NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_CONTRACTPARTY' AND KSQL_COL_NAME IN ('FPARTENTRYFROM'))
ALTER TABLE T_ER_CONTRACTPARTY ADD (FPARTENTRYFROM VARCHAR(20) DEFAULT '0' NOT NULL);



/***历史数据升级**/
UPDATE  T_ER_CONTRACTPARTY SET  FPARTENTRYFROM ='botp'  WHERE FID IN (SELECT FID FROM T_ER_CONTRACTBILL WHERE  FDETAILTYPE ='biztype_changebill'  );






