T-SQL Tutorial

T-SQL Sp_pkeys


On Transact SQL language the sp_pkeys is part of Catalog Stored Procedures and return primary key information for a single table in the current database.

Sp_pkeys syntax:

sp_pkeys [ @table_name = 'Table name.' ] ,
[ @table_owner = 'The database user who created the table.' ] ,
[ @table_qualifier = 'Database name.' ] ;





Sp_pkeys example:

USE model;
GO
EXEC sp_pkeys
@table_name = 'students',
@table_owner = 'dbo',
@table_qualifier = 'model';