Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
ravilobo
Master Smack Fu Yak Hacker
1184 Posts |
Posted - 2010-02-24 : 14:32:22
|
What is the SQL to list a Primary Key index?------------------------I think, therefore I am - Rene Descartes |
|
Kristen
Test
22859 Posts |
Posted - 2010-02-25 : 01:50:17
|
sp_help 'MyTable'will tell you - but I doubt that is what you want? |
 |
|
ravilobo
Master Smack Fu Yak Hacker
1184 Posts |
Posted - 2010-02-25 : 09:39:08
|
Thanm you, Kristen. I wanted to use a the SQL in a script. Here is what I found, SELECT CONSTRAINT_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE TABLE_NAME ='Table_Name' AND CONSTRAINT_TYPE ='PRIMARY KEY'------------------------I think, therefore I am - Rene Descartes |
 |
|
Kristen
Test
22859 Posts |
Posted - 2010-02-25 : 10:06:35
|
Yup, that will do it nicely |
 |
|
|
|
|