SQL: How to find primary key column names in SQL Server

Another question that I answered on a forum recently was about how to find the primary key column (or columns) for a table.

Here's an example of the code required:

I hope that helps someone.

Leave a Reply

Your email address will not be published.