6
Answers

Stored procedure to give primary key column details of table

Prasad Godbole

Prasad Godbole

12y
2.1k
1
Hi

We want to write a stored procedure which will give what are the primary keys of a specific table and what are its data type etc.. i.e. details about that column such as type and length

we have tried following SPROC

EXEC sp_pkeys '<table name>'

Also this SPROC should work on Microsoft SQL Server 2000, 2005, 2008 and its later version.

Please advise us in this.

Thanks and Regards
Prasad


Answers (6)