sys.foreign_keys (Transact-SQL)
TOC
Collapse the table of content
Expand the table of content

sys.foreign_keys (Transact-SQL)

 

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

Contains a row per object that is a FOREIGN KEY constraint, with sys.object.type = F.

Column nameData typeDescription
<Columns inherited from sys.objects>For a list of columns that this view inherits, see sys.objects (Transact-SQL).
referenced_object_idintID of the referenced object.
key_index_idintID of the key index within the referenced object.
is_disabledbitFOREIGN KEY constraint is disabled.
is_not_for_replicationbitFOREIGN KEY constraint was created by using the NOT FOR REPLICATION option.
is_not_trustedbitFOREIGN KEY constraint has not been verified by the system.
delete_referential_actiontinyintThe referential action that was declared for this FOREIGN KEY when a delete happens.

0 = No action

1 = Cascade

2 = Set null

3 = Set default
delete_referential_action_descnvarchar(60)Description of the referential action that was declared for this FOREIGN KEY when a delete occurs:

NO_ACTION

CASCADE

SET_NULL

SET_DEFAULT
update_referential_actiontinyintThe referential action that was declared for this FOREIGN KEY when an update happens.

0 = No action

1 = Cascade

2 = Set null

3 = Set default
update_referential_action_descnvarchar(60)Description of the referential action that was declared for this FOREIGN KEY when an update happens:

NO_ACTION

CASCADE

SET_NULL

SET_DEFAULT
is_system_namedbit1 = Name was generated by the 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.

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

Community Additions

ADD
Show:
© 2016 Microsoft