/**Begin D:\k3Cloud\PDM_UPGRADE\PDM1\MDS_constraint.sql **/
 EXEC P_ALTERPK 'PK_MDS_DPSPLANMATERIAL', 'T_MDS_DPSPLANMATERIAL', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_DPSPLANMATERIALORG', 'T_MDS_DPSPLANMATERIALORG', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_DPSRUNLOG', 'T_MDS_DPSRUNLOG', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_DPSRUNLOG_L', 'T_MDS_DPSRUNLOG_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_DPSTABLE', 'T_MDS_DPSTABLE', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_DPSTABLE_A', 'T_MDS_DPSTABLE_A', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MDS_DPSTABLE_A_Q') CREATE INDEX IDX_MDS_DPSTABLE_A_Q ON T_MDS_DPSTABLE_A ( FWEEKDELIVERY );


 EXEC P_ALTERPK 'PK_MDS_DPSTABLE_L', 'T_MDS_DPSTABLE_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_DPSTABLEMBOM', 'T_MDS_DPSTABLEMBOM', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_DPSWEEK', 'T_MDS_DPSWEEK', 'FENTRYID', '1';

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



/**End D:\k3Cloud\PDM_UPGRADE\PDM1\MDS_constraint.sql **/
