/** 商旅集成关联数据映射建表 Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\ER_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_ER_TRIPSYNC_DATAMAPPING') 
 CREATE TABLE T_ER_TRIPSYNC_DATAMAPPING (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(200) DEFAULT ' ' NOT NULL,
FSTATUS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FENABLE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FDATATYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FINNERDATAID BIGINT DEFAULT 0 NOT NULL,
FOUTDATAID BIGINT DEFAULT 0 NOT NULL,
FSERVER NVARCHAR(30) DEFAULT ' ' NOT NULL
);

 EXEC P_ALTERPK 'PK_T_ER_TRIPSYNC_DATAMAPPING', 'T_ER_TRIPSYNC_DATAMAPPING', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_DATAMAPPING_INNERDATAID') CREATE INDEX IDX_DATAMAPPING_INNERDATAID ON T_ER_TRIPSYNC_DATAMAPPING ( FINNERDATAID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_DATAMAPPING_OUTDATAID') CREATE INDEX IDX_DATAMAPPING_OUTDATAID ON T_ER_TRIPSYNC_DATAMAPPING ( FOUTDATAID );



/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\ER_constraint.sql **/