IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_BANKVCCHECK' AND KSQL_COL_NAME ='FADJUSTSTATUS') 
 ALTER TABLE T_CAS_BANKVCCHECK ADD (FADJUSTSTATUS CHAR(1) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_BANKVCCHECK' AND KSQL_COL_NAME ='FBALADJUST') 
 ALTER TABLE T_CAS_BANKVCCHECK ADD (FBALADJUST NVARCHAR(80) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_BANKVCCHECK' AND KSQL_COL_NAME ='FJOURNALAMT') 
 ALTER TABLE T_CAS_BANKVCCHECK ADD (FJOURNALAMT DECIMAL(19,6) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_BANKVCCHECK' AND KSQL_COL_NAME ='FSTMTAMT') 
 ALTER TABLE T_CAS_BANKVCCHECK ADD (FSTMTAMT DECIMAL(19,6) DEFAULT 0 NOT NULL );
 
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CAS_RECONCILIATION_E') 
 CREATE TABLE T_CAS_RECONCILIATION_E (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FRULESNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDATAFILTERDESC NVARCHAR(1024) DEFAULT ' ' NOT NULL,
FDATAFILTERDESC_REAL NCLOB,
FDATAFILTERDESC_REAL_TAG NCLOB
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CAS_RECONCILIATIONRULE') 
 CREATE TABLE T_CAS_RECONCILIATIONRULE (
FID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(30) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FENABLE INT DEFAULT 0 NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FORGFIELD BIGINT DEFAULT 0 NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_AGENTPAYBILLENTRY' AND KSQL_COL_NAME ='FBANKCHECKFLAG') 
 ALTER TABLE T_CAS_AGENTPAYBILLENTRY ADD (FBANKCHECKFLAG VARCHAR(50) DEFAULT ' ' NOT NULL );
 
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CHECKEDRESULT' AND KSQL_COL_NAME ='FBATCHNO') 
 ALTER TABLE T_CAS_CHECKEDRESULT ADD (FBATCHNO NVARCHAR(5) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CHECKEDRESULT' AND KSQL_COL_NAME ='FMATCHRULEID') 
 ALTER TABLE T_CAS_CHECKEDRESULT ADD (FMATCHRULEID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CHECKEDRESULT' AND KSQL_COL_NAME ='FMATCHRULE') 
 ALTER TABLE T_CAS_CHECKEDRESULT ADD (FMATCHRULE NCLOB );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CHECKEDRESULT' AND KSQL_COL_NAME ='FMATCHRULE_TAG') 
 ALTER TABLE T_CAS_CHECKEDRESULT ADD (FMATCHRULE_TAG NCLOB );
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CHECKEDRESULTENTRY' AND KSQL_COL_NAME ='FSETTLEMENTNUMBER') 
 ALTER TABLE T_CAS_CHECKEDRESULTENTRY ADD (FSETTLEMENTNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL );
 