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

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


 EXEC P_ALTERPK 'PK_MDS_ASSIGNED_L', 'T_MDS_ASSIGNED_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_ASSIGNENTRY', 'T_MDS_ASSIGNENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_FNREPORT', 'T_MDS_FNREPORT', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MDS_FNREPORT_MAT') CREATE INDEX IDX_MDS_FNREPORT_MAT ON T_MDS_FNREPORT ( FMATERIALID );


 EXEC P_ALTERPK 'PK_MDS_PROVIDERRECORD', 'T_MDS_PROVIDERRECORD', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MDS_PROVIDERRECORD_MAT') CREATE INDEX IDX_MDS_PROVIDERRECORD_MAT ON T_MDS_PROVIDERRECORD ( FMATERIEL );


 EXEC P_ALTERPK 'PK_MDS_REQUESTRECORD', 'T_MDS_REQUESTRECORD', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MDS_REQUESTRECORD_MAT') CREATE INDEX IDX_MDS_REQUESTRECORD_MAT ON T_MDS_REQUESTRECORD ( FMATERIEL );


 EXEC P_ALTERPK 'PK_MDS_SETOFFLOG', 'T_MDS_SETOFFLOG', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_SETOFFLOG_L', 'T_MDS_SETOFFLOG_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_SETOFFLOGENTRY', 'T_MDS_SETOFFLOGENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_SETOFFLOGTOOL', 'T_MDS_SETOFFLOGTOOL', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_SETOFFORDER', 'T_MDS_SETOFFORDER', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_SETOFFORDER_L', 'T_MDS_SETOFFORDER_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_SETOFFSETENT', 'T_MDS_SETOFFSETENT', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_SETOFFSETENTG', 'T_MDS_SETOFFSETENTG', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_SETOFFSETENTS', 'T_MDS_SETOFFSETENTS', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_SETOFFSETTING', 'T_MDS_SETOFFSETTING', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_SETOFFSETTING_L', 'T_MDS_SETOFFSETTING_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_SETOFFTOOL', 'T_MDS_SETOFFTOOL', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_SETOFFTOOL_L', 'T_MDS_SETOFFTOOL_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_SETOFFTOOLENTRY', 'T_MDS_SETOFFTOOLENTRY', 'FENTRYID', '1';

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

 EXEC P_ALTERPK 'PK_T_MDS_SETOFFSETMANU', 'T_MDS_SETOFFSETMANU', 'FPKID', '1';

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

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