/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\MSPLAN_constraint.sql **/
 EXEC P_ALTERPK 'PK_T_MRP_CPS_ADJUSTENTRY', 'T_MRP_CPS_ADJUSTENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_CPS_DETAIL', 'T_MRP_CPS_DETAIL', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_CPS_DETAILENTRY', 'T_MRP_CPS_DETAILENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_CPS_ORGENTRY', 'T_MRP_CPS_ORGENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_CPS_PLANPENTRY', 'T_MRP_CPS_PLANPENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_CPS_PLANPRO', 'T_MRP_CPS_PLANPRO', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_CPS_PLANPRO_L', 'T_MRP_CPS_PLANPRO_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_CPS_PLANPRODMENTRY', 'T_MRP_CPS_PLANPRODMENTRY', 'FDETAILID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_CPS_RENTRY', 'T_MRP_CPS_RENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_CPS_SENTRY', 'T_MRP_CPS_SENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_CPSPLAN_TAG', 'T_MRP_CPSPLAN_TAG', 'FPKID', '1';

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



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