Cry How to...
List all indexes on a table
To list all the indexes on a table use:
where table_name is the name of the table for which the list of indexes are required.
This lists the index name, the type (e.g. clustered, non clustered, unique etc) and which columns the index is created on. Further details can be found by consulting the SQL server documentation.
Alternately, just to list the names of the indexes (with no further information about the index) you could use:
In SQL Server 2000 and earlier this was:
or in SQL Server 7 or 2000:
both produce the same list of index names, but the first also provides information about each of those indexes.
These notes have been tested against SQL Server 7, 2000, 2005 and 2008.
About the author: Brian Cryer is a dedicated software developer and webmaster. For his day job he develops websites and desktop applications as well as providing IT services. He moonlights as a technical author and consultant.