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

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


 EXEC P_ALTERPK 'PK_T_MSPLAN_DATAVERSION_L', 'T_MSPLAN_DATAVERSION_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_MSPLAN_DV_DETAIL', 'T_MSPLAN_DV_DETAIL', 'FDETAILID', '1';

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


 EXEC P_ALTERPK 'PK_T_MSPLAN_DV_HISENTRY', 'T_MSPLAN_DV_HISENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_MSPLAN_DV_SYNCINFO', 'T_MSPLAN_DV_SYNCINFO', 'FDETAILID', '1';

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


 EXEC P_ALTERPK 'PK_T_MSPLAN_SSENTRY', 'T_MSPLAN_SSENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_MSPLAN_SYNCSETTINGS', 'T_MSPLAN_SYNCSETTINGS', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_T_MSPLAN_SYNCSETTINGS_L', 'T_MSPLAN_SYNCSETTINGS_L', 'FPKID', '1';

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

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