IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_ER_TRIP_ENUM_ENTRY')
CREATE TABLE T_ER_TRIP_ENUM_ENTRY (
                                      FID BIGINT DEFAULT 0 NOT NULL,
                                      FENTRYID BIGINT DEFAULT 0 NOT NULL,
                                      FSEQ BIGINT DEFAULT 0 NOT NULL,
                                      FJFIELD VARCHAR(255) DEFAULT ' ' NOT NULL,
                                      FJVALUE VARCHAR(255) DEFAULT ' ' NOT NULL,
                                      FBFIELD VARCHAR(255) DEFAULT ' ' NOT NULL,
                                      FBVALUE VARCHAR(255) DEFAULT ' ' NOT NULL
);


EXEC P_ALTERPK 'PK_T_ER_TRIP_ENUM_ENTRY', 'T_ER_TRIP_ENUM_ENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'UQ_TRIP_ENUM_FID') CREATE UNIQUE INDEX UQ_TRIP_ENUM_FID ON T_ER_TRIP_ENUM_ENTRY ( FID ,FJFIELD ,FJVALUE );

