/**Begin SYS_table.sql **/

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CTBOTP_BILLROUTE')
CREATE TABLE T_CTBOTP_BILLROUTE (
                                    FID BIGINT DEFAULT 0 NOT NULL,
                                    FSTENANTCODE VARCHAR(50) DEFAULT ' ' NOT NULL,
                                    FSACCOUNTID VARCHAR(50) DEFAULT ' ' NOT NULL,
                                    FSENTITYKEY VARCHAR(36) DEFAULT ' ' NOT NULL,
                                    FSBILLID BIGINT DEFAULT 0 NOT NULL,
                                    FTTENANTCODE VARCHAR(50) DEFAULT ' ' NOT NULL,
                                    FTACCOUNTID VARCHAR(50) DEFAULT ' ' NOT NULL,
                                    FTENTITYKEY VARCHAR(36) DEFAULT ' ' NOT NULL,
                                    FTBILLID BIGINT DEFAULT 0 NOT NULL,
                                    FCREATETIME DATETIME DEFAULT GETDATE() NOT NULL
);

EXEC p_AlterPK 'PK_CTBOTP_BILLROUTE', 't_ctbotp_billroute', 'fid', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_CTBOTP_BILLROUTE' AND KSQL_INDNAME = 'IDX_CBR_SBILLID')
CREATE INDEX IDX_CBR_SBILLID ON T_CTBOTP_BILLROUTE (FSBILLID );

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_CTBOTP_BILLROUTE' AND KSQL_INDNAME = 'IDX_CBR_TBILLID')
CREATE INDEX IDX_CBR_TBILLID ON T_CTBOTP_BILLROUTE (FTBILLID );



/**End SYS_table.sql **/