IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_REIMBCLEARAPPLYENTRY' AND KSQL_COL_NAME ='FAPPLYFROMCITY') 
 ALTER TABLE T_ER_REIMBCLEARAPPLYENTRY ADD (FAPPLYFROMCITY VARCHAR(80) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_REIMBCLEARAPPLYENTRY' AND KSQL_COL_NAME ='FAPPLYTOCITY') 
 ALTER TABLE T_ER_REIMBCLEARAPPLYENTRY ADD (FAPPLYTOCITY VARCHAR(80) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_REIMBCLEARAPPLYENTRY' AND KSQL_COL_NAME ='FAPPLYSTARTDATE') 
 ALTER TABLE T_ER_REIMBCLEARAPPLYENTRY ADD (FAPPLYSTARTDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_REIMBCLEARAPPLYENTRY' AND KSQL_COL_NAME ='FAPPLYENDDATE') 
 ALTER TABLE T_ER_REIMBCLEARAPPLYENTRY ADD (FAPPLYENDDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_REIMBCLEARAPPLYENTRY' AND KSQL_COL_NAME ='FAPPLYRVEHICLE') 
 ALTER TABLE T_ER_REIMBCLEARAPPLYENTRY ADD (FAPPLYRVEHICLE VARCHAR(10) DEFAULT ' ' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_ER_TRIPAPPLYTRAVELERS') 
 CREATE TABLE T_ER_TRIPAPPLYTRAVELERS (
FPKID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);

 EXEC P_ALTERPK 'PK_T_ER_TRIPAPPLYTRAVELERS', 'T_ER_TRIPAPPLYTRAVELERS', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_TRAVELERS_FPKID') CREATE INDEX IDX_ER_TRAVELERS_FPKID ON T_ER_TRIPAPPLYTRAVELERS ( FENTRYID );


