~fhusson

How to test if an index exist in SQL Server

IF INDEXPROPERTY(OBJECT_ID('TableName'), 'IndexName', 'IndexID') IS NOT NULL
 PRINT 'Index is here'
ELSE
 PRINT 'Index not found'
Discuss on Twitter