IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_ER_USER_SUMMARY')
CREATE TABLE T_ER_USER_SUMMARY (
                                   FID BIGINT DEFAULT 0 NOT NULL,
                                   FUSERID VARCHAR(50) DEFAULT ' ' NOT NULL,
                                   FSUMMARYYEAR VARCHAR(50) DEFAULT ' ' NOT NULL,
                                   FSUMMARY VARCHAR(255) DEFAULT ' ' NOT NULL,
                                   FSUMMARY_TAG NCLOB,
                                   FSUMMARYEND DATETIME,
                                   FUPDATETIME DATETIME
);

EXEC p_AlterPK 'PK_ER_USER_SUMMARY', 'T_ER_USER_SUMMARY', 'FID', '1';
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_ER_USER_SUMMARY' AND KSQL_INDNAME = 'IDX_USERID_SUMMARYEND_INDEX')
CREATE INDEX IDX_USERID_SUMMARYEND_INDEX ON T_ER_USER_SUMMARY (FUSERID ,FSUMMARYYEAR );
