Sp_fkeys - TSQL Tutorial

On Transact SQL language the sp_fkeys is part of Catalog Stored Procedures and return logical foreign key information for the current database.

Sp_fkeys syntax:

sp_fkeys [ @pktable_name = 'Table name.' ] ,
[ @pktable_owner = 'The database user who created the table.' ] ,
[ @pktable_qualifier = 'Database name.' ] ,
[ @fktable_name = 'Table name.' ] ,
[ @fktable_owner = 'The database user who created the table.' ] ,
[ @fktable_qualifier = 'Database name.' ] ;


Sp_fkeys example:

USE model;
GO
EXEC sp_fkeys
@pktable_name = 'students',
@pktable_owner = 'dbo',
@pktable_qualifier = 'model',
@fktable_name = 'students',
@fktable_owner = 'dbo',
@fktable_qualifier = 'model';