Tuesday, May 22, 2012

Msg 3723, Level 16, State 5, Line 1 An explicit DROP INDEX is not allowed on index

We may receive the below error message while remvoing index from a table.

An explicit DROP INDEX is not allowed on index 'TestTable.PX_TestTable'. It is being used for UNIQUE KEY constraint enforcement.

This cannot be dont using Drop Index, we need to use Alter Index statement to remove index.

The DROP INDEX statement does not apply to indexes created by defining PRIMARY KEY or UNIQUE constraints. To remove the constraint and corresponding index, use ALTER TABLE with the DROP CONSTRAINT clause.”


ALTER TABLE [dbo].[TestTable] DROP CONSTRAINT [PX_TestTable]

No comments: