IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CTBOTP_UNIQUEDB')
CREATE TABLE T_CTBOTP_UNIQUEDB (
                                   FID BIGINT DEFAULT 0 NOT NULL,
                                   FNUMBER VARCHAR(30) DEFAULT ' ' NOT NULL,
                                   FCREATORID BIGINT DEFAULT 0 NOT NULL,
                                   FCREATETIME DATETIME DEFAULT GETDATE() NOT NULL
);

EXEC p_AlterPK 'pk_ctbotp_uniquedb', 't_ctbotp_uniquedb', 'fid', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_CTBOTP_UNIQUEDB' AND KSQL_INDNAME = 'IDX_CTBOTP_UNIQUEDB_NUMBER')
CREATE INDEX IDX_CTBOTP_UNIQUEDB_NUMBER ON T_CTBOTP_UNIQUEDB (FNUMBER );
