Pinchy
Pinchy

Reputation: 1536

ALTER COLUMN datatype with indexed one

Is there a way I can change a column data type without dropping the index.

With disabling option it can't 'ALTER INDEX ALL ON ' + @tablename + ' DISABLE '

Upvotes: 0

Views: 213

Answers (1)

Lokesh
Lokesh

Reputation: 7940

Logically speaking this should not be possible. You are changing the underlying data type, so reindexing has to happen.

So if you have a number column and you change it varchar then database will have to rearrange things which implies index will have to be recreated.

Upvotes: 2

Related Questions