/**Begin D:\PDM_UPGRADE\PDM1\CAS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CLAIMDETAILENTRY' AND KSQL_COL_NAME IN ('FCLAIMDIMENSION')) 
 ALTER TABLE T_CAS_CLAIMDETAILENTRY ADD (FCLAIMDIMENSION NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CLAIMDETAILENTRY' AND KSQL_COL_NAME IN ('FCLAIMCOMTROL')) 
 ALTER TABLE T_CAS_CLAIMDETAILENTRY ADD (FCLAIMCOMTROL CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CLAIMNOTICEBILL_E' AND KSQL_COL_NAME IN ('FCLAIMDIMENSION')) 
 ALTER TABLE T_CAS_CLAIMNOTICEBILL_E ADD (FCLAIMDIMENSION NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CLAIMNOTICEBILL_E' AND KSQL_COL_NAME IN ('FCLAIMCOMTROL')) 
 ALTER TABLE T_CAS_CLAIMNOTICEBILL_E ADD (FCLAIMCOMTROL CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_RECBILLCHANGBENTRY' AND KSQL_COL_NAME IN ('FBCLAIMDIMENSION')) 
 ALTER TABLE T_CAS_RECBILLCHANGBENTRY ADD (FBCLAIMDIMENSION NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_RECBILLCHANGBENTRY' AND KSQL_COL_NAME IN ('FBCLAIMCOMTROL')) 
 ALTER TABLE T_CAS_RECBILLCHANGBENTRY ADD (FBCLAIMCOMTROL CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_RECEIVINGBILLENTRY' AND KSQL_COL_NAME IN ('FCLAIMDIMENSION')) 
 ALTER TABLE T_CAS_RECEIVINGBILLENTRY ADD (FCLAIMDIMENSION NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_RECEIVINGBILLENTRY' AND KSQL_COL_NAME IN ('FCLAIMCOMTROL')) 
 ALTER TABLE T_CAS_RECEIVINGBILLENTRY ADD (FCLAIMCOMTROL CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_RECBILLCHANGENTRY' AND KSQL_COL_NAME IN ('FCLAIMDIMENSION')) 
 ALTER TABLE T_CAS_RECBILLCHANGENTRY ADD (FCLAIMDIMENSION NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_RECBILLCHANGENTRY' AND KSQL_COL_NAME IN ('FCLAIMCOMTROL')) 
 ALTER TABLE T_CAS_RECBILLCHANGENTRY ADD (FCLAIMCOMTROL CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CAS_CLAIMCONTROL') 
 CREATE TABLE T_CAS_CLAIMCONTROL (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(30) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATER BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIER BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CAS_CLAIMCONTROL_ENTRY') 
 CREATE TABLE T_CAS_CLAIMCONTROL_ENTRY (
FCOREBILLTYPE NVARCHAR(255) DEFAULT ' ' NOT NULL,
FCLAIMDIMENSION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FCLAIMCOMTROL CHAR(1) DEFAULT '0' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL
);



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