Home > database >  Changing a column data type results in an index that is too large
Changing a column data type results in an index that is too large

Time:01-21

In the sql server db table I have a field CarDealerOwner of type nvarchar(255). Now I want to change the max length of the accepted values from 255 to 900 characters.

When I manually try to change from 255 to 900 the sql server management studio pop up with the message:

Changing a column data type results in an index that is too large.
....
Changing the data type of column CarDealerOwner causes the following indexes to exceed the maximum index size of 900 bytes:...

Do you want to proceed with the data type change and delete the indexes?

Does this actually mean that I would need to recreate index again? Any other smarter way?

CodePudding user response:

The 900-byte limit on the indexed field size is inherent to SQL server, so you can't change that.

NVARCHAR() columns take two bytes per character, so you could resize your column to 450 instead of 900.

You could change the data type from NVARCHAR to VARCHAR, as long as your data is in Western European languages. That is probably not a good assumption.

  •  Tags:  
  • Related