Tuesday 7 May 2019

MSSQL - Fix Error - ALTER TABLE ALTER COLUMN Col1 failed because one or more objects access this column.



Msg 5074, Level 16, State 1, Line 1
The index 'IX_TableWithIndexTest' is dependent on column 'Col1'.
Msg 4922, Level 16, State 9, Line 1
ALTER TABLE ALTER COLUMN Col1 failed because one or more objects access this column.

Watch this example on YouTube



To Fix it replace

Alter Table TableWithIndexTest
Alter Column Col1 nvarchar(max) null
GO

with (remove index related to the column you want to alter)

Drop Index TableWithIndexTest.IX_TableWithIndexTest
GO

Alter Table TableWithIndexTest
Alter Column Col1 nvarchar(max) null
GO

No comments:

Post a Comment