/**Begin D:\k3Cloud\PDM_UPGRADE\PDM1\MDS_constraint.sql **/
 EXEC P_ALTERPK 'PK_MDS_FORECASTBYEQ', 'T_MDS_FORECASTBYEQ', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MDS_FORECASTBYEQ_LOG') CREATE INDEX IDX_MDS_FORECASTBYEQ_LOG ON T_MDS_FORECASTBYEQ ( FLOGID );


 EXEC P_ALTERPK 'PK_MDS_FORECASTBYEQ_ATA', 'T_MDS_FORECASTBYEQ_ATA', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_FORECASTBYTIME', 'T_MDS_FORECASTBYTIME', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MDS_FORECAST_LOG') CREATE INDEX IDX_MDS_FORECAST_LOG ON T_MDS_FORECASTBYTIME ( FLOGID );


 EXEC P_ALTERPK 'PK_MDS_FORECASTBYTIME_ATA', 'T_MDS_FORECASTBYTIME_ATA', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_GENERALLOG', 'T_MDS_GENERALLOG', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_GENERALLOG_L', 'T_MDS_GENERALLOG_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_GENERALPLAN', 'T_MDS_GENERALPLAN', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MDS_GENERALPLAN_LOG') CREATE INDEX IDX_MDS_GENERALPLAN_LOG ON T_MDS_GENERALPLAN ( FLOGID );


 EXEC P_ALTERPK 'PK_MDS_GENERALSET', 'T_MDS_GENERALSET', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_GENERALSET_GROUP', 'T_MDS_GENERALSET_GROUP', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_GENERALSET_L', 'T_MDS_GENERALSET_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_GENERALSUG_ENTRY', 'T_MDS_GENERALSUG_ENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_GENERALSUGGEST', 'T_MDS_GENERALSUGGEST', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MDS_GENERALSUGGEST_LOG') CREATE INDEX IDX_MDS_GENERALSUGGEST_LOG ON T_MDS_GENERALSUGGEST ( FLOGID );


 EXEC P_ALTERPK 'PK_MDS_GENERALSUGGEST_ATA', 'T_MDS_GENERALSUGGEST_ATA', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MDS_GENERALSUG_ATA_EID') CREATE INDEX IDX_MDS_GENERALSUG_ATA_EID ON T_MDS_GENERALSUGGEST_ATA ( FENTRYID );


 EXEC P_ALTERPK 'PK_MDS_MATERIALPARAM', 'T_MDS_MATERIALPARAM', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_MATERIALPARAM_L', 'T_MDS_MATERIALPARAM_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_PROBALOG_BIZTYPE', 'T_MDS_PROBALOG_BIZTYPE', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_PROBALOG_CABIN', 'T_MDS_PROBALOG_CABIN', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_PROBALOG_POLARIS', 'T_MDS_PROBALOG_POLARIS', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_TARGETM_TIME_ATA', 'T_MDS_TARGETM_TIME_ATA', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_TARGETMATERI_EQ_ATA', 'T_MDS_TARGETMATERI_EQ_ATA', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_TARGETMATERIAL_ATA', 'T_MDS_TARGETMATERIAL_ATA', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_TARGETMATERIAL_EQ', 'T_MDS_TARGETMATERIAL_EQ', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MDS_TARGET_EQ_LOG') CREATE INDEX IDX_MDS_TARGET_EQ_LOG ON T_MDS_TARGETMATERIAL_EQ ( FLOGID );


 EXEC P_ALTERPK 'PK_MDS_TARGETMATERIAL_TIME', 'T_MDS_TARGETMATERIAL_TIME', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MDS_TARGET_TIME_LOG') CREATE INDEX IDX_MDS_TARGET_TIME_LOG ON T_MDS_TARGETMATERIAL_TIME ( FLOGID );

 EXEC P_ALTERPK 'PK_MDS_TARGETMATERIAL', 'T_MDS_TARGETMATERIAL', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MDS_TARGETMATERIAL_LOG') CREATE INDEX IDX_MDS_TARGETMATERIAL_LOG ON T_MDS_TARGETMATERIAL ( FLOGID );



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