Sql 2005 - nvarchar (max) - Cannot create a string of size 8064 that is larger than the allowable maximum of 8060

I get this error when I change the alter alter column from nvarchar (4000) to nvarchar (max):

Cannot create a string of size 8064 that is larger than the allowable maximum of 8060

I looked at similar questions and I still can’t explain why this is not working.

Convert nvarchar (4000) to nvarchar (max)

Cannot create a row of size 8064 that is larger than the valid row size of 8060

I also tried replacing the alter statement with the add column and updating:

BEFORE:

alter table myTable alter column myColumn nvarchar(max)

AFTER:

exec sp_rename 'dbo.myTable.myColumn', 'myColumn_old', 'COLUMN'
GO
alter table myTable add myColumn nvarchar(max)
GO 
update myTable set myColumn = myColumn_old

But I still get the same error.

How can I update this column and what happens here?

+3
source share
1

, 4 . a nvarchar(max), , 4 .

:

select top 10 * from myTable order by len(myColumn_old) desc

, . - , nvarchar(max), :

insert into NewTable (col1, col2, ...) select col1, col2, ... from OldTable
+1

Source: https://habr.com/ru/post/1775047/


All Articles