Voici ses principaux champs :
Nom du champ | Type du champ | Description du champ |
name | sysname | Nom de la clé étrangère. |
object_id | int | Identifiant de la clé étrangère. |
schema_id | int | Identifiant du schéma de la table. |
SELECT
a.name,
h.name,
'',
g.name,
c.name,
d.name,
j.name,
'',
i.name,
e.name
,
f.name,
f.column_id
FROM sys.foreign_keys a, sys.foreign_key_columns b, sys.tables c, sys.columns d, sys.schemas g, sys.sysusers h, sys.tables e, sys.columns f, sys.schemas i, sys.sysusers j
WHERE
b.constraint_object_id=a.object_id
AND c.object_id=b.referenced_object_id
AND d.object_id=b.referenced_object_id
AND d.column_id=b.referenced_column_id
AND g.schema_id=c.schema_id
AND h.uid=g.principal_id
AND e.object_id=b.parent_object_id
AND f.object_id=b.parent_object_id
AND f.column_id=b.parent_column_id
AND i.schema_id=e.schema_id
AND j.uid=i.principal_id
AND g.name LIKE 'MonSchema%'
AND e.name LIKE 'MaTable%'
ORDER BY i.name, e.name, a.name, f.column_id;