/**Begin D:\PDM_UPGRADE\PDM1\CAS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_RECBILLCHANG_E' AND KSQL_COL_NAME IN ('FQUOTATION'))
ALTER TABLE T_CAS_RECBILLCHANG_E ADD (FQUOTATION NVARCHAR(5) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_RECEIVINGBILL_E' AND KSQL_COL_NAME IN ('FQUOTATION'))
ALTER TABLE T_CAS_RECEIVINGBILL_E ADD (FQUOTATION NVARCHAR(5) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_PAYAPPLYBILL' AND KSQL_COL_NAME IN ('FQUOTATION'))
ALTER TABLE T_CAS_PAYAPPLYBILL ADD (FQUOTATION NVARCHAR(5) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_AGENTPAYBILL_E' AND KSQL_COL_NAME IN ('FAGREEDQUOTATION'))
ALTER TABLE T_CAS_AGENTPAYBILL_E ADD (FAGREEDQUOTATION NVARCHAR(5) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_AGENTPAYBILL_E' AND KSQL_COL_NAME IN ('FDPPAYQUOTATION'))
ALTER TABLE T_CAS_AGENTPAYBILL_E ADD (FDPPAYQUOTATION NVARCHAR(5) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_AGENTPAYBILL_E' AND KSQL_COL_NAME IN ('FPAYQUOTATION'))
ALTER TABLE T_CAS_AGENTPAYBILL_E ADD (FPAYQUOTATION NVARCHAR(5) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_PAYMENTBILL_E' AND KSQL_COL_NAME IN ('FPAYQUOTATION'))
ALTER TABLE T_CAS_PAYMENTBILL_E ADD (FPAYQUOTATION NVARCHAR(5) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_PAYMENTBILL_E' AND KSQL_COL_NAME IN ('FDPPAYQUOTATION'))
ALTER TABLE T_CAS_PAYMENTBILL_E ADD (FDPPAYQUOTATION NVARCHAR(5) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_PAYMENTBILL_E' AND KSQL_COL_NAME IN ('FAGREEDQUOTATION'))
ALTER TABLE T_CAS_PAYMENTBILL_E ADD (FAGREEDQUOTATION NVARCHAR(5) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_TRANSFERAPPLYBILL' AND KSQL_COL_NAME IN ('FQUOTATION'))
ALTER TABLE T_CAS_TRANSFERAPPLYBILL ADD (FQUOTATION NVARCHAR(5) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_PAYINFOENTRY' AND KSQL_COL_NAME IN ('FPAYCURRENCYID')) 
 ALTER TABLE T_CAS_PAYINFOENTRY ADD (FPAYCURRENCYID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_PAYINFOENTRY' AND KSQL_COL_NAME IN ('FISDIFFCUR')) 
 ALTER TABLE T_CAS_PAYINFOENTRY ADD (FISDIFFCUR CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_PAYINFOENTRY' AND KSQL_COL_NAME IN ('FEXRATETABLEID')) 
 ALTER TABLE T_CAS_PAYINFOENTRY ADD (FEXRATETABLEID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_PAYINFOENTRY' AND KSQL_COL_NAME IN ('FEXRATEDATE')) 
 ALTER TABLE T_CAS_PAYINFOENTRY ADD (FEXRATEDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_PAYINFOENTRY' AND KSQL_COL_NAME IN ('FPAYAMOUNT')) 
 ALTER TABLE T_CAS_PAYINFOENTRY ADD (FPAYAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_PAYINFOENTRY' AND KSQL_COL_NAME IN ('FEXCHANGERATE')) 
 ALTER TABLE T_CAS_PAYINFOENTRY ADD (FEXCHANGERATE DECIMAL(23,10) DEFAULT 0 NOT NULL );

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