sys.foreign_key_columns (Transact-SQL)


THIS TOPIC APPLIES TO: yesSQL Server (starting with 2008)yesAzure SQL DatabaseyesAzure SQL Data Warehouse yesParallel Data Warehouse

Contains a row for each column, or set of columns, that comprise a foreign key.

Column nameData typeDescription
constraint_object_idintID of the FOREIGN KEY constraint.
constraint_column_idintID of the column, or set of columns, that comprise the FOREIGN KEY (1..n where n=number of columns).
parent_object_idintID of the parent of the constraint, which is the referencing object.
parent_column_idintID of the parent column, which is the referencing column.
referenced_object_idintID of the referenced object, which has the candidate key.
referenced_column_idintID of the referenced column (candidate key column).

The visibility of the metadata in catalog views is limited to securables that a user either owns or on which the user has been granted some permission. For more information, see Metadata Visibility Configuration.

Object Catalog Views (Transact-SQL)
Catalog Views (Transact-SQL)
Querying the SQL Server System Catalog FAQ

Community Additions