Error message:
Cannot create a row of size 8066 which is greater than the allowable maximum row size of 8060.
The case:
I tried to alter a column from nvarchar(max) to nvarchar(1500).
I run:
UPDATE MyTable set Col1 = Left(Col1, 1500) where len(Col1) > 1500
ALTER TABLE [dbo].[MyTable] ALTER COLUMN [Col1] [nvarchar](1500) NULL
And I get the error message for the ALTER TABLE statement.
Solution:
ALTER TABLE [dbo].[MyTable] REBUILD -- before the ALTER COLUMN statement.
No comments:
Post a Comment