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

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


 EXEC P_ALTERPK 'PK_MDS_GENERAL', 'T_MDS_GENERAL', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_GENERAL_L', 'T_MDS_GENERAL_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_GENERALENTITY', 'T_MDS_GENERALENTITY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_HISUSECALCLOG', 'T_MDS_HISUSECALCLOG', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_HISUSECALCLOG_L', 'T_MDS_HISUSECALCLOG_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_HISUSEDETAIL', 'T_MDS_HISUSEDETAIL', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_HISUSERESULT', 'T_MDS_HISUSERESULT', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_HISUSESET', 'T_MDS_HISUSESET', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_HISUSESET_L', 'T_MDS_HISUSESET_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_MATERIALBACKUP', 'T_MDS_MATERIALBACKUP', 'FID', '1';

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



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