/**Begin D:\PDM_UPGRADE\PDM1\CAS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_AGENTPAYBILL' AND KSQL_COL_NAME IN ('FBUSINESSTYPE'))
 ALTER TABLE T_CAS_AGENTPAYBILL ADD (FBUSINESSTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_PAYCHGBILLENTRY' AND KSQL_COL_NAME IN ('FBUSINESSTYPE'))
 ALTER TABLE T_CAS_PAYCHGBILLENTRY ADD (FBUSINESSTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_RECEIVINGBILL' AND KSQL_COL_NAME IN ('FBUSINESSTYPE'))
 ALTER TABLE T_CAS_RECEIVINGBILL ADD (FBUSINESSTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_PAYMENTBILL' AND KSQL_COL_NAME IN ('FINSTITUTIONCODE'))
 ALTER TABLE T_CAS_PAYMENTBILL ADD (FINSTITUTIONCODE NVARCHAR(80) DEFAULT ' ' NOT NULL );

/**End D:\PDM_UPGRADE\PDM1\CAS_table.sql **/

/**Begin D:\PDM_UPGRADE\PDM1\CAS_table.sql **/
-- 付款申请单数币业务改造 新增业务类型 运营商机构编号字段
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_PAYAPPLYENTRY' AND KSQL_COL_NAME IN ('FBUSINESSTYPE'))
 ALTER TABLE T_CAS_PAYAPPLYENTRY ADD (FBUSINESSTYPE VARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_PAYAPPLYENTRY' AND KSQL_COL_NAME IN ('FINSTITUTIONCODE'))
 ALTER TABLE T_CAS_PAYAPPLYENTRY ADD (FINSTITUTIONCODE NVARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_PAYINFOENTRY' AND KSQL_COL_NAME IN ('FBUSINESSTYPE'))
 ALTER TABLE T_CAS_PAYINFOENTRY ADD (FBUSINESSTYPE VARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_PAYINFOENTRY' AND KSQL_COL_NAME IN ('FRECINSTITUTIONCODE'))
 ALTER TABLE T_CAS_PAYINFOENTRY ADD (FRECINSTITUTIONCODE NVARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_PAYINFOENTRY' AND KSQL_COL_NAME IN ('FPAYINSTITUTIONCODE'))
 ALTER TABLE T_CAS_PAYINFOENTRY ADD (FPAYINSTITUTIONCODE NVARCHAR(30) DEFAULT ' ' NOT NULL );

/**End D:\PDM_UPGRADE\PDM1\CAS_table.sql **/

/**Begin D:\PDM_UPGRADE\PDM1\CAS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_PAYCHGBILLENTRY' AND KSQL_COL_NAME IN ('FINSTITUTIONCODE'))
 ALTER TABLE T_CAS_PAYCHGBILLENTRY ADD (FINSTITUTIONCODE NVARCHAR(80) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_PAYCHGBILLENTRY' AND KSQL_COL_NAME IN ('FAFTERINSTITUTIONCODE'))
 ALTER TABLE T_CAS_PAYCHGBILLENTRY ADD (FAFTERINSTITUTIONCODE NVARCHAR(80) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_RECBILLCHANG' AND KSQL_COL_NAME IN ('FBUSINESSTYPE'))
  ALTER TABLE T_CAS_RECBILLCHANG ADD (FBUSINESSTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL );

/**End D:\PDM_UPGRADE\PDM1\CAS_table.sql **/
