Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Getting unique or primary key columns for a given table

By Kiran Kumar,

1. Select the database and open a new query window.

2. Pass the table name to @table_name variable.

3. Run the script.

Total article views: 1242 | Views in the last 30 days: 1
primary key (pk)    
unique index