/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\EB_constraint.sql **/
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_ROLLINIT_P2') CREATE INDEX IDX_EB_ROLLINIT_P2 ON T_EB_ROLLINIT ( FMODELID );

 EXEC P_ALTERPK 'PK_T_EB_SHAREDIMENSION_L', 'T_EB_SHAREDIMENSION_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_SHAREDIMENSION_L_P1') CREATE INDEX IDX_EB_SHAREDIMENSION_L_P1 ON T_EB_SHAREDIMENSION_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_T_EB_ADJUSTBILL_BP', 'T_EB_ADJUSTBILL_BP', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_ADJUSTBILL_BP_P1') CREATE INDEX IDX_EB_ADJUSTBILL_BP_P1 ON T_EB_ADJUSTBILL_BP ( FID );


 EXEC P_ALTERPK 'PK_T_EB_SHAREDIMENSION', 'T_EB_SHAREDIMENSION', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_SHAREDIMENSION_P1') CREATE INDEX IDX_EB_SHAREDIMENSION_P1 ON T_EB_SHAREDIMENSION ( FNUMBER );


 EXEC P_ALTERPK 'PK_T_EB_SHAREDIMENSIONENTRY', 'T_EB_SHAREDIMENSIONENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_SHAREDIMENSIONENTRY_P1') 
 CREATE INDEX IDX_EB_SHAREDIMENSIONENTRY_P1 ON T_EB_SHAREDIMENSIONENTRY ( FID );
 
 
 -- 修改维度匹配关系索引 
IF EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_DIMMATERULEAPP') 
DROP INDEX T_EB_DIMMATERULEAPP.IDX_EB_DIMMATERULEAPP;

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_DIMMATERULEAPP') 
CREATE INDEX IDX_EB_DIMMATERULEAPP ON T_EB_DIMMATERULEAPP (FID);


 
IF EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_DIMMATERULEBILL') 
DROP INDEX T_EB_DIMMATERULEBILL.IDX_EB_DIMMATERULEBILL;

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_DIMMATERULEBILL') 
CREATE INDEX IDX_EB_DIMMATERULEBILL ON T_EB_DIMMATERULEBILL (FNUMBER, FEFFECTIVETIME, FINVALIDTIME);
 



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