Link to home
Start Free TrialLog in
Avatar of brgdotnet
brgdotnetFlag for United States of America

asked on

How to query for the primary key names of a table?

I have a query which will find all column names for a table. It works great, however I need a query that will somehow tell me which of the columns are primary keys for the table. Does anyone know how to do this? Here is my sql query :

select TABLE_CATALOG as dBName, TABLE_NAME, COLUMN_NAME from INFORMATION_SCHEMA.COLUMNS
 where TABLE_NAME='abc'
ASKER CERTIFIED SOLUTION
Avatar of Mark Bullock
Mark Bullock
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial