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

EXEC p_AlterPK 'PK_ER_FEE_EXPENSEITEMS', 'T_ER_FEE_EXPENSEITEMS', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_ER_FEE_EXPENSEITEMS' AND KSQL_INDNAME = 'IDX_FEE_EXPENSEITEMS_FID')
 CREATE INDEX IDX_FEE_EXPENSEITEMS_FID ON T_ER_FEE_EXPENSEITEMS (FID );