View properties
2016 (13.x) and later versions Azure SQL Managed Instance You
2016 (13.x) and later versions
Azure
SQL Managed Instance
Analytics Platform System (PDW)
You can view the foreign key attributes of a relationship in SQL Server by using SQL Server
Management Studio or Transact-SQL.
The visibility of the metadata in catalog views is limited to securables that a user either owns,
or on which the user was granted some permission. For more information, see
Metadata
Visibility Configuration.
- Open the Table Designer for the table containing the foreign key you want to view, right-
click in the Table Designer, and choose
from the shortcut menu.
- In the
dialog box, select the relationship with properties you
want to view.
If the foreign key columns are related to a primary key, the primary key columns are identified
in
by a primary key symbol in the row selector.
- In
, connect to an instance of Database Engine.
-
On the Standard bar, select.
-
Copy and paste the following example into the query window and select. The
example returns all foreign keys and their properties for the table
in the sample database.
HumanResources.Employee
USE
AdventureWorks2022;
GO
SELECT f.name
AS foreign_key_name,
OBJECT_NAME(f.parent_object_id)
AS table_name,
COL_NAME(fc.parent_object_id, fc.parent_column_id)
AS