/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\EB_constraint.sql **/
 EXEC P_ALTERPK 'PK_T_EB_PJOTEMDISTRIBUTE', 'T_EB_PJOTEMDISTRIBUTE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_MODEL_ENTITY_TEMP') CREATE INDEX IDX_EB_MODEL_ENTITY_TEMP ON T_EB_PJOTEMDISTRIBUTE ( FMODEL ,FENTITY ,FTEMPLATE );


 EXEC P_ALTERPK 'PK_T_EB_PJOTEMPLATE', 'T_EB_PJOTEMPLATE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_PJO_CATA_MODL_NUM') CREATE INDEX IDX_EB_PJO_CATA_MODL_NUM ON T_EB_PJOTEMPLATE ( FNUMBER ,FTEMPLATECATAID ,FMODEL );


 EXEC P_ALTERPK 'PK_T_EB_PJOTEMPLATECATA', 'T_EB_PJOTEMPLATECATA', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_PJOTEMPCATA_MODEL_NUM') CREATE INDEX IDX_EB_PJOTEMPCATA_MODEL_NUM ON T_EB_PJOTEMPLATECATA ( FNUMBER ,FMODEL );


 EXEC P_ALTERPK 'PK_T_BGM_PRODETAIL', 'T_BGM_PRODETAIL', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_BGM_PROJECTAPPLY', 'T_BGM_PROJECTAPPLY', 'FID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'INDEX_BGM_PROJECT_FMODEL') CREATE INDEX INDEX_BGM_PROJECT_FMODEL ON T_BGM_PROJECTAPPLY ( FMODELID ,FTEMPLATEMODEL );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'INDEX_BGM_PROJECT_FTEMPLATE') CREATE INDEX INDEX_BGM_PROJECT_FTEMPLATE ON T_BGM_PROJECTAPPLY ( FCURTEMPLATEID );


 EXEC P_ALTERPK 'PK_T_EB_PJOTEMCLODIM', 'T_EB_PJOTEMCLODIM', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_EB_PJOTEMPLATE_ORG', 'T_EB_PJOTEMPLATE_ORG', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_EB_PJOTEMPLATE_YERA', 'T_EB_PJOTEMPLATE_YERA', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_EB_SHARESCHEME_ACCOUNT', 'T_EB_SHARESCHEME_ACCOUNT', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_EB_SHARESCHEME_GROUP', 'T_EB_SHARESCHEME_GROUP', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_SHARESCHEME_GROUP_MODEL') CREATE INDEX IDX_SHARESCHEME_GROUP_MODEL ON T_EB_SHARESCHEME_GROUP ( FMODEL );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_SHARESCHEME_GROUP_P') CREATE INDEX IDX_SHARESCHEME_GROUP_P ON T_EB_SHARESCHEME_GROUP ( FPARENT );


 EXEC P_ALTERPK 'PK_T_EB_EXECUTESHARE_LOG', 'T_EB_EXECUTESHARE_LOG', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_EXECUTE_LOG_SCHEMEID') CREATE INDEX IDX_EB_EXECUTE_LOG_SCHEMEID ON T_EB_EXECUTESHARE_LOG ( FSHARESCHEMEID );


 EXEC P_ALTERPK 'PK_T_EB_SHARESCHEME_ENTITY', 'T_EB_SHARESCHEME_ENTITY', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_SHARESCHE_ENTI_GROUP') CREATE INDEX IDX_EB_SHARESCHE_ENTI_GROUP ON T_EB_SHARESCHEME_ENTITY ( FSCHEMEGROUP );


 EXEC P_ALTERPK 'PK_T_EB_SHARESCHEME_AUDIT', 'T_EB_SHARESCHEME_AUDIT', 'FPKID', '1';

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



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