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 |
smallint |
Number of columns in the foreign key |
status |
smallint |
Options and indicators |
frgndbid |
smallint null |
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) null |
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) null |
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 |
Table 1-22 shows the satus bits in sysreferences.
Decimal |
Hex |
Status |
---|---|---|
2 |
0x2 |
The referential constraint has a match full option |
Clustered index on tableid, frgndbname
Nonclustered index on constrid, frgndbname
Nonclustered index on reftabid, indexid, pmrydbname