/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\CAS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CAS_CLAIMNOTICEBILL_C') 
 CREATE TABLE T_CAS_CLAIMNOTICEBILL_C (
FID BIGINT DEFAULT 0 NOT NULL,
FRULESNAME NVARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CLAIMBILL' AND KSQL_COL_NAME ='FRECVIEWPAYER') 
 ALTER TABLE T_CAS_CLAIMBILL ADD (FRECVIEWPAYER NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_PAYCHGBILLENTRY' AND KSQL_COL_NAME ='FPAYEETYPE') 
 ALTER TABLE T_CAS_PAYCHGBILLENTRY ADD (FPAYEETYPE NVARCHAR(30) DEFAULT ' ' NOT NULL );
 EXEC p_AlterColumn 'T_CAS_PAYCHGBILL', 'FREMARK', 'NVARCHAR(255)', 'NOT NULL', '1111', ''' ''';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_PAYCHGBILL' AND KSQL_COL_NAME ='FALTERATIONUSER') 
 ALTER TABLE T_CAS_PAYCHGBILL ADD (FALTERATIONUSER BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_PAYCHGBILL' AND KSQL_COL_NAME ='FBILLSCODE') 
 ALTER TABLE T_CAS_PAYCHGBILL ADD (FBILLSCODE NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_PAYCHGBILL' AND KSQL_COL_NAME ='FBILLNAME') 
 ALTER TABLE T_CAS_PAYCHGBILL ADD (FBILLNAME NVARCHAR(50) DEFAULT ' ' NOT NULL );

/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\CAS_table.sql **/
