/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\MRP_constraint.sql **/
 EXEC P_ALTERPK 'PK_MRP_SIMCOLORDER', 'T_MRP_SIMCOLORDER', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_SIMCOLORDER') CREATE INDEX IDX_MRP_SIMCOLORDER ON T_MRP_SIMCOLORDER ( FORGID ,FBILLNO );


 EXEC P_ALTERPK 'PK_MRP_SIMULATEORDER', 'T_MRP_SIMULATEORDER', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_SIMULATEORDER') CREATE INDEX IDX_MRP_SIMULATEORDER ON T_MRP_SIMULATEORDER ( FORGID ,FBILLNO );


 EXEC P_ALTERPK 'PK_MRP_SIMULATEORDER_L', 'T_MRP_SIMULATEORDER_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_MRP_SIMULATEORDERCENTRY', 'T_MRP_SIMULATEORDERCENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_SIMULATEORDERCENTRY') CREATE INDEX IDX_MRP_SIMULATEORDERCENTRY ON T_MRP_SIMULATEORDERCENTRY ( FID ,FSEQ );


 EXEC P_ALTERPK 'PK_MRP_SIMULATIONOUTLINE', 'T_MRP_SIMULATIONOUTLINE', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_SIMULATIONOUTLINE') CREATE INDEX IDX_MRP_SIMULATIONOUTLINE ON T_MRP_SIMULATIONOUTLINE ( FID ,FSEQ );


 EXEC P_ALTERPK 'PK_MRP_SIMULATIONSUMMARY', 'T_MRP_SIMULATIONSUMMARY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_SIMULATIONSUMMARY') CREATE INDEX IDX_MRP_SIMULATIONSUMMARY ON T_MRP_SIMULATIONSUMMARY ( FID ,FSEQ );


 EXEC P_ALTERPK 'PK_MRP_SIMULATION', 'T_MRP_SIMULATION', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_SIMULATION') CREATE INDEX IDX_MRP_SIMULATION ON T_MRP_SIMULATION ( FORGID ,FBILLNO );


 EXEC P_ALTERPK 'PK_MRP_SIMULATIONCALC', 'T_MRP_SIMULATIONCALC', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_SIMULATIONCALC') CREATE INDEX IDX_MRP_SIMULATIONCALC ON T_MRP_SIMULATIONCALC ( FCACULATENUMBER );


 EXEC P_ALTERPK 'PK_MRP_SIMULATIONCALCENTRY', 'T_MRP_SIMULATIONCALCENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_SIMULATIONCALCENTRY') CREATE INDEX IDX_MRP_SIMULATIONCALCENTRY ON T_MRP_SIMULATIONCALCENTRY ( FID ,FSEQ );


 EXEC P_ALTERPK 'PK_T_MRP_SIMULATEORDERENTRY', 'T_MRP_SIMULATEORDERENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_SIMULATEORDERENTRY') CREATE INDEX IDX_MRP_SIMULATEORDERENTRY ON T_MRP_SIMULATEORDERENTRY ( FID ,FSEQ );


 EXEC P_ALTERPK 'PK_MRP_SIMULATIONDETAIL', 'T_MRP_SIMULATIONDETAIL', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_SIMULATIONDETAIL') CREATE INDEX IDX_MRP_SIMULATIONDETAIL ON T_MRP_SIMULATIONDETAIL ( FID ,FSEQ );
 
 EXEC P_ALTERPK 'PK_T_MRP_SIMULATEFIELDENTRY', 'T_MRP_SIMULATEFIELDENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_SIMULATEFIELDENTRY') CREATE INDEX IDX_MRP_SIMULATEFIELDENTRY ON T_MRP_SIMULATEFIELDENTRY ( FID ,FSEQ );

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