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

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


 EXEC P_ALTERPK 'PK_T_MRP_DEMANDGROUP_L', 'T_MRP_DEMANDGROUP_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_DEMANDGROUPENTRY', 'T_MRP_DEMANDGROUPENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_DEMANDMODEL_L', 'T_MRP_DEMANDMODEL_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_MANUSTRATEGY', 'T_MRP_MANUSTRATEGY', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_MANUSTRATEGY_L', 'T_MRP_MANUSTRATEGY_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_MERGECYCLE', 'T_MRP_MERGECYCLE', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_MERGECYCLE_L', 'T_MRP_MERGECYCLE_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_MERGECYCLEENTRY', 'T_MRP_MERGECYCLEENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_MERGEDIMEN', 'T_MRP_MERGEDIMEN', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_MERGEDIMEN_L', 'T_MRP_MERGEDIMEN_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_MERGEDIMENENTRY', 'T_MRP_MERGEDIMENENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_MERGERULE', 'T_MRP_MERGERULE', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_MERGERULE_L', 'T_MRP_MERGERULE_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_STRATEGYGROUP', 'T_MRP_STRATEGYGROUP', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_STRATEGYGROUP_L', 'T_MRP_STRATEGYGROUP_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_STRATEGYENTRY', 'T_MRP_STRATEGYENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_DEMANDMODEL', 'T_MRP_DEMANDMODEL', 'FID', '1';

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



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