Transact SQL – Constraint – Primary Key

There are a couple of approaches one can use to get the primary key for a table. Here are some of those ways: sp_pkeys sp_primarykeys INFORMATION_SCHEMA.TABLE_CONSTRAINTS sp_pkeys Syntax: Sample: Output: sp_primarykeys Though sp_primarykeys was added to gain insight into remote data sources, you can use it it to query your local data source, as well. … Continue reading Transact SQL – Constraint – Primary Key