IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_ER_REIMBCLEARAPPLYENTRY') 
 CREATE TABLE T_ER_REIMBCLEARAPPLYENTRY (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FAPPLYBILLNO NVARCHAR(80) DEFAULT '0' NOT NULL,
FAPPLYPERSON BIGINT DEFAULT 0 NOT NULL,
FAPPLYBILLDATE DATETIME,
FAPPLYDESCRIPTION VARCHAR(1000) DEFAULT ' ' NOT NULL,
FAPPLYCURRENCY BIGINT DEFAULT 0 NOT NULL,
FAPPLYEXCHANGERATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FREIMBURSEDAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL
);
 EXEC P_ALTERPK 'PK_T_ER_REIMBCLEARAPPLYENTRY', 'T_ER_REIMBCLEARAPPLYENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_CLEARAPPLYENT_FID') CREATE INDEX IDX_ER_CLEARAPPLYENT_FID ON T_ER_REIMBCLEARAPPLYENTRY ( FID );


