/**Begin  **/

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_APPLYENTITYMAP') 
 CREATE TABLE T_EB_APPLYENTITYMAP (
FID BIGINT DEFAULT 0 NOT NULL,
FADMINORG BIGINT DEFAULT 0 NOT NULL,
FENTITYID BIGINT DEFAULT 0 NOT NULL,
FMODELID BIGINT DEFAULT 0 NOT NULL,
FCREATERID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FCREATEDATE DATETIME,
FMODIFYDATE DATETIME
);

EXEC P_ALTERPK 'pk_eb_applyentitymap', 'T_EB_APPLYENTITYMAP', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'idx_eb_applyentitymap_fk') CREATE INDEX idx_eb_applyentitymap_fk ON T_EB_APPLYENTITYMAP (FADMINORG ASC);

/**End **/