sysreferences

Provides information about foreign key relationships between tables.

Name Datatype Description
indexid smallint The ID of the unique index defined on the referenced columns.
constrid int The object ID of the constraint, as stored in sysobjects.
tableid int The object ID of the referencing table that contains the foreign key.
reftabid int The object ID of the referenced table that contains the primary key.
keycnt smallint The number of columns in the foreign key.
status smallint Internal options and indicators for the foreign key.
frgndbid smallint null The ID of the database containing the referencing table.
pmrydbid smallint The ID of the database containing the referenced primary key table.
spare2 int Reserved for internal system use.
fokey1 ... fokey16 smallint The column IDs of the referencing table’s columns involved in the foreign key (up to 16 columns).
refkey1 ... refkey16 smallint The column IDs of the referenced table’s columns that the foreign key points to (up to 16 columns).
frgndbname varchar(30) null The name of the database containing the referencing table.
NULL – The current database table.
pmrydbname varchar(30) null The name of the database containing the referenced table.
NULL – The current database table.