/**
  单头多选基础资料：座位等级
 */
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_ER_TRIPSTDVEHICLE_SEATS')
CREATE TABLE T_ER_TRIPSTDVEHICLE_SEATS (
                                           FPKID BIGINT DEFAULT 0 NOT NULL,
                                           FID BIGINT DEFAULT 0 NOT NULL,
                                           FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);

EXEC p_AlterPK 'PK_ER_TRIPSTDVEHICLE_SEATS', 'T_ER_TRIPSTDVEHICLE_SEATS', 'FPKID', '1';
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_ER_TRIPSTDVEHICLE_SEATS' AND KSQL_INDNAME = 'IDX_VEHICLE_SEATS_FID')
 CREATE INDEX IDX_VEHICLE_SEATS_FID ON T_ER_TRIPSTDVEHICLE_SEATS (FID );

/**
增加分录
 */

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_ER_TRIPSTDVEHICLE_ENTRY')
CREATE TABLE T_ER_TRIPSTDVEHICLE_ENTRY (
                                           FID BIGINT DEFAULT 0 NOT NULL,
                                           FSEAT BIGINT DEFAULT 0 NOT NULL,
                                           FENTRYID BIGINT DEFAULT 0 NOT NULL,
                                           FSEQ INT DEFAULT 0 NOT NULL
);

EXEC p_AlterPK 'PK_ER_TRIPSTDVEHICLE_ENTRY', 'T_ER_TRIPSTDVEHICLE_ENTRY', 'FENTRYID', '1';








