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

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


 EXEC P_ALTERPK 'PK_T_MRP_BOMEXPAND_L', 'T_MRP_BOMEXPAND_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_BOMEXPANDENTRY', 'T_MRP_BOMEXPANDENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_DEMANDBILL_L', 'T_MRP_DEMANDBILL_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_DEMANDBILLENTRY', 'T_MRP_DEMANDBILLENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_INH', 'T_MRP_INH', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_INH_L', 'T_MRP_INH_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_INHENTRY', 'T_MRP_INHENTRY', 'FENTRYID', '1';

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

 EXEC P_ALTERPK 'PK_T_MRP_DEMANDBILL', 'T_MRP_DEMANDBILL', 'FID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_DEMANDBILL') CREATE  CLUSTERED INDEX IDX_MRP_DEMANDBILL ON T_MRP_DEMANDBILL ( FNUMBER );



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