sp_fkeys

Description

Returns information about foreign key constraints created with the create table or alter table command in the current database.

Syntax

sp_fkeys pktable_name [, pktable_owner]
	[, pktable_qualifier] [, fktable_name] 
	[, fktable_owner] [, fktable_qualifier]

Parameters

pktable_name

is the name of the primary key table. The use of wildcard characters in pattern matching is not supported. You must specify either the pktable_name or the fktable_name, or both.

pktable_owner

is the name of the primary key table owner. The use of wildcard characters in pattern matching is not supported. If you do not specify the table owner, sp_fkeys looks for a table owned by the current user and then for a table owned by the Database Owner.

pktable_qualifier

is the name of the database that contains the primary key table. This can be either the current database or NULL.

fktable_name

is the name of the foreign key table. The use of wildcard characters in pattern matching is not supported. Either the fktable_name or the pktable_name, or both, must be given.

fktable_owner

is the name of the foreign key table owner. The use of wildcard characters in pattern matching is not supported. If an fktable_owner is not specified, sp_fkeys looks for a table owned by the current user and then for a table owned by the Database Owner.

fktable_qualifier

is the name of the database that contains the foreign key table. This can be either the current database or null.

Usage

Permissions

Any user can execute sp_fkeys.