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

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


 EXEC P_ALTERPK 'PK_T_MRP_RUNCONFIG_L', 'T_MRP_RUNCONFIG_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_MQDATA', 'T_MRP_MQDATA', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_MQDATA') CREATE INDEX IDX_MRP_MQDATA ON T_MRP_MQDATA ( FPLANID ,FPLANNUMBER );


 EXEC P_ALTERPK 'PK_T_MRP_PRODFORECAST', 'T_MRP_PRODFORECAST', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_PRODFORECAS') CREATE INDEX IDX_MRP_PRODFORECAS ON T_MRP_PRODFORECAST ( FLASTMODIFIER );


 EXEC P_ALTERPK 'PK_T_MRP_PLANORDER_L', 'T_MRP_PLANORDER_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_SUPPLYDATA_E', 'T_MRP_SUPPLYDATA_E', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_BOMDATA_E', 'T_MRP_BOMDATA_E', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_REQUIREDATA_E', 'T_MRP_REQUIREDATA_E', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_REQUIREDATA_F', 'T_MRP_REQUIREDATA_F', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_ORDERRECORD', 'T_MRP_ORDERRECORD', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_ORDERRECORD') CREATE INDEX IDX_MRP_ORDERRECORD ON T_MRP_ORDERRECORD ( FMATERIEL );



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