IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_ER_TRIP_USERGRANT')
CREATE TABLE T_ER_TRIP_USERGRANT
(
    FID            BIGINT        DEFAULT 0   NOT NULL,
    FGRANTUSERNO   VARCHAR(50)   DEFAULT ' ' NOT NULL,
    FGRANTUSERNAME VARCHAR(50)   DEFAULT ' ' NOT NULL,
    FGRANTSERVERS  VARCHAR(255)  DEFAULT ' ' NOT NULL,
    FGRANTTIME     TIMESTAMP,
    FGRANTIP       VARCHAR(50)   DEFAULT ' ' NOT NULL,
    FGRANTMODEL    VARCHAR(50)   DEFAULT ' ' NOT NULL,
    FGRANTCONTENT  VARCHAR(255) DEFAULT ' ' NOT NULL,
    FGRANTCONTENT_TAG  NCLOB DEFAULT ' ' NOT NULL,
    FBILLSTATUS    VARCHAR(30)   DEFAULT ' ' NOT NULL,
    FGRANT         CHAR(1)       DEFAULT '0' NOT NULL,
    FGRANTUSER     BIGINT        DEFAULT 0
);



EXEC P_ALTERPK 'PK_ER_USERGRANT', 'T_ER_TRIP_USERGRANT', 'FID', '0';

-- 创建授权员工工号索引
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_USERGRANT_USERNO') CREATE INDEX IDX_USERGRANT_USERNO ON T_ER_TRIP_USERGRANT ( FGRANTUSERNO,FGRANTUSERNAME );







