/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\PDM_constraint.sql **/
 EXEC P_ALTERPK 'PK_FMM_PROGRAMME', 'T_FMM_PROGRAMME', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FMM_PROGRAMME_FNUM') CREATE INDEX IDX_FMM_PROGRAMME_FNUM ON T_FMM_PROGRAMME ( FNUMBER );
 
 EXEC P_ALTERPK 'PK_FMM_PROGRAMME_L', 'T_FMM_PROGRAMME_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FMM_PROGRAMME_L') CREATE INDEX IDX_FMM_PROGRAMME_L ON T_FMM_PROGRAMME_L ( FID, FLOCALEID );
 
 EXEC P_ALTERPK 'PK_FMM_ASSEMBLYENTRY', 'T_FMM_ASSEMBLYENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FMM_ASSEMBLYENTRY_FID') CREATE INDEX IDX_FMM_ASSEMBLYENTRY_FID ON T_FMM_ASSEMBLYENTRY ( FID);
 
 EXEC P_ALTERPK 'PK_FMM_STAGEENTRY', 'T_FMM_STAGEENTRY', 'FDETAILID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FMM_STAGEENTRY_FK') CREATE INDEX IDX_FMM_STAGEENTRY_FK ON T_FMM_STAGEENTRY ( FENTRYID);
 
 EXEC P_ALTERPK 'PK_FMM_PROENTRY', 'T_FMM_PROENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FMM_PROENTRY_FID') CREATE INDEX IDX_FMM_PROENTRY_FID ON T_FMM_PROENTRY ( FID);
 
 EXEC P_ALTERPK 'PK_FMM_ACTIVEENTRY', 'T_FMM_ACTIVEENTRY', 'FDETAILID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FMM_ACTIVEENTRY_FK') CREATE INDEX IDX_FMM_ACTIVEENTRY_FK ON T_FMM_ACTIVEENTRY ( FENTRYID);
 
 /**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\PDM_constraint.sql **/
