How do you check if an index exists in a table?

You can find out if the index exists for a table by querying the sys.indexes table as shown in this blog post’s code sample.

How do you check if an index exists in a table?

Use AdventureWorks2014
GO
SELECT * 
FROM sys.indexes 
WHERE object_id = OBJECT_ID('HumanResources.Employee')

This will list out all the indexes of the table.

How do you check if an index exists in a table?

Leave Your Comment

Liked this content?. Please spread the word :)