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

EXEC P_ALTERPK 'pk_entryimp_templateattach', 't_entryimp_templateattach', 'FPKID', '1';
