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


This content was proof-read by Grammarly. You can Try Grammary for FREE

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?
Newsletter Signup

Subscribe to our weekly newsletter below and never miss the latest product or an exclusive offer.

Newsletter Signup

Subscribe to our weekly newsletter below and never miss the latest product or an exclusive offer.

%d bloggers like this: