sys.key_constraints (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 object that is a primary key or unique constraint. Includes sys.objects.type PK and UQ.

Column nameData typeDescription
<Columns inherited from sys.objects>For a list of columns that this view inherits, see sys.objects (Transact-SQL).
unique_index_idintID of the corresponding unique index in the parent object that was created to enforce this constraint.
is_system_namedbit1 = Name was generated by system.

0 = Name was supplied by the user.

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