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

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


 EXEC P_ALTERPK 'PK_T_MRP_PLS_SCHEME_L', 'T_MRP_PLS_SCHEME_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_PLSCRSUBENTRY', 'T_MRP_PLSCRSUBENTRY', 'FDETAILID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_PLSCRSUBENTRY') CREATE INDEX IDX_MRP_PLSCRSUBENTRY ON T_MRP_PLSCRSUBENTRY ( FENTRYID ,FSEQ );


 EXEC P_ALTERPK 'PK_T_MRP_PLSFCSUBENTRY', 'T_MRP_PLSFCSUBENTRY', 'FDETAILID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_PLSFCSUBENTRY') CREATE INDEX IDX_MRP_PLSFCSUBENTRY ON T_MRP_PLSFCSUBENTRY ( FENTRYID ,FSEQ );


 EXEC P_ALTERPK 'PK_T_MRP_PLSMATENTRY', 'T_MRP_PLSMATENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_PLSSRCENTRY', 'T_MRP_PLSSRCENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_PLSWCENTRY', 'T_MRP_PLSWCENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_PLSWCSUBENTRY', 'T_MRP_PLSWCSUBENTRY', 'FDETAILID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_PLSWCSUBENTRY') CREATE INDEX IDX_MRP_PLSWCSUBENTRY ON T_MRP_PLSWCSUBENTRY ( FENTRYID ,FSEQ );

 EXEC P_ALTERPK 'PK_T_MRP_PLANDISPATCH_E', 'T_MRP_PLANDISPATCH_E', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_PLANDISPATCH_E') CREATE INDEX IDX_MRP_PLANDISPATCH_E ON T_MRP_PLANDISPATCH_E ( FFORECASTPLANNO );


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