sys.sp_foreignkeys
spforeignkeys returns the foreign keys that reference primary keys on the table in the linked server.
What changes
- Input
- Not stated in the Microsoft summary.
- Output or change
- Not stated in the Microsoft summary.
Syntax at a glance
sys.sp_foreignkeys
[ @table_server = ] N'table_server'
[ , [ @pktab_name = ] N'pktab_name' ]
[ , [ @pktab_schema = ] N'pktab_schema' ]
[ , [ @pktab_catalog = ] N'pktab_catalog' ]
[ , [ @fktab_name = ] N'fktab_name' ]
[ , [ @fktab_schema = ] N'fktab_schema' ]
[ , [ @fktab_catalog = ] N'fktab_catalog' ]
[ ; ]
Work example
spforeignkeys returns the foreign keys that reference primary keys on the table in the linked server.
Read the parameter list and identify the provider operation it supports. Do not call it directly from application T-SQL.
Check your work Why does Microsoft limit direct calls to this procedure?
Open Microsoft Learn for full syntax, permissions, and details for your version.