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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_DENIFIEXCINFO') CREATE INDEX IDX_MRP_DENIFIEXCINFO ON T_MRP_DENIFIEXCINFO ( FNUMBER ,FCREATEORGID );


 EXEC P_ALTERPK 'PK_T_MRP_DENIFIEXCINFO_L', 'T_MRP_DENIFIEXCINFO_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_EXCEPTIONGROUP', 'T_MRP_EXCEPTIONGROUP', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_EXCEPTIONGROUP') CREATE INDEX IDX_MRP_EXCEPTIONGROUP ON T_MRP_EXCEPTIONGROUP ( FNUMBER ,FCREATEORGID );


 EXEC P_ALTERPK 'PK_T_MRP_EXCEPTIONGROUP_L', 'T_MRP_EXCEPTIONGROUP_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_FIELDSETUP', 'T_MRP_FIELDSETUP', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_FIELDSETUP') CREATE INDEX IDX_MRP_FIELDSETUP ON T_MRP_FIELDSETUP ( FNUMBER ,FCREATEORGID );


 EXEC P_ALTERPK 'PK_T_MRP_FIELDSETUP_L', 'T_MRP_FIELDSETUP_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_FSENTRY', 'T_MRP_FSENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_PLANPROENTRY', 'T_MRP_PLANPROENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_PLANPROGRAM', 'T_MRP_PLANPROGRAM', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_PLANPROGRAM') CREATE INDEX IDX_MRP_PLANPROGRAM ON T_MRP_PLANPROGRAM ( FNUMBER ,FCREATEORGID );


 EXEC P_ALTERPK 'PK_T_MRP_PLANPROGRAM_L', 'T_MRP_PLANPROGRAM_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_PLANPROREENTRY', 'T_MRP_PLANPROREENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_PLANPROSCENTRY', 'T_MRP_PLANPROSCENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_PRIORITY', 'T_MRP_PRIORITY', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_PRIORITY') CREATE INDEX IDX_MRP_PRIORITY ON T_MRP_PRIORITY ( FNUMBER ,FCREATEORGID );


 EXEC P_ALTERPK 'PK_T_MRP_PRIORITY_L', 'T_MRP_PRIORITY_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_PRIORITYENTRY', 'T_MRP_PRIORITYENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_RSREGISTER', 'T_MRP_RSREGISTER', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_RSREGISTER') CREATE INDEX IDX_MRP_RSREGISTER ON T_MRP_RSREGISTER ( FNUMBER ,FCREATEORGID );


 EXEC P_ALTERPK 'PK_T_MRP_RSREGISTER_L', 'T_MRP_RSREGISTER_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_BFTRANSFER', 'T_MRP_BFTRANSFER', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_BFTRANSFER') CREATE INDEX IDX_MRP_BFTRANSFER ON T_MRP_BFTRANSFER ( FNUMBER ,FCREATEORGID );


 EXEC P_ALTERPK 'PK_T_MRP_BFTRANSFER_L', 'T_MRP_BFTRANSFER_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_BUSINESSPLANENTRY', 'T_MRP_BUSINESSPLANENTRY', 'FENTRYID', '1';

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


 EXEC p_AlterPK 'PK_T_MRP_PLANPRODMENTRY', 'T_MRP_PLANPRODMENTRY', 'FDETAILID', '1';
 
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_PLANPRODMENTRY') CREATE INDEX IDX_MRP_PLANPRODMENTRY ON T_MRP_PLANPRODMENTRY ( FSEQ ,FENTRYID );


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