All databases
sysreferences contains one row for each referential integrity constraint declared on a table or column.
The columns for sysreferences are:
Name |
Datatype |
Description |
---|---|---|
indexid |
smallint |
ID of the unique index on referenced columns |
constrid |
int |
Object ID of the constraint from sysobjects |
tableid |
int |
Object ID of the referencing table |
reftabid |
int |
Object ID of the referenced table |
keycnt |
tinyint |
Number of columns in the foreign key |
status |
smallint |
Reserved |
frgndbid |
smallint |
Database ID of the database that includes the referenced table (the table with the foreign key). |
pmrydbid |
smallint |
Database ID of the database that includes the referenced table (the table with the primary key). |
spare2 |
int |
Reserved |
fokey1 ... fokey16 |
smallint |
Column ID of the first to the 16th referencing column |
refkey1 ... refkey16 |
smallint |
Column ID of the first to the 16th referenced column |
frgndbname |
varchar(30) |
Name of the database that includes the referencing table (the table with the foreign key); NULL if the referencing table is in the current database |
pmrydbname |
varchar(30) |
Name of the database that includes the referenced table (the table with the primary key); NULL if the referenced table is in the current database |
Clustered index On tableid, frgndbname
Nonclustered index On constrid, frgndbname, indexid, pmrydbname, reftabid