Prasad Godbole

Prasad Godbole

  • NA
  • 153
  • 171.2k

Stored procedure to give primary key column details of table

Jul 18 2012 3:48 AM
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)