Check for and drop an existing index

Use the following script to drop a specific index if it exists.

IF EXISTS (SELECT * FROM sys.indexes WHERE name='IX_IndexName' AND object_id = OBJECT_ID('TableName'))
	DROP INDEX IX_IndexName ON [dbo].[TableName];
GO
Subscribe

0 comments