String or binary data would be truncated.

We converted a SQL field from NText to NVarChar(Max), the conversion went smoothly, but recently when our programs do a record update, we began to receive the message "String or binary data would be truncated." We checked the length of the new data for this field, and it is longer than the original values but it is way smaller than the 4,000 character maximum, we think that the problem is due to the fact that the field record is located at the end of a disk page boundary, and SQL can not extend the length of the field, our solution to this was delete the record and insert a new one with the new data.

We are currently using MS-SQL 2016, the table was created in MS-SQL 2005.

We are looking for a more smooth solution or a fix to this problem.
Who is Participating?
Scott PletcherSenior DBACommented:
Would have to see the actual code that's manipulating the data prior to and during the INSERT to get a better idea of what is happening.  Also, make sure no old text functions are running on the column, and that the data is not being inserted into the wrong column, one that does have a smaller size.

Btw, the size limit on "MAX" columns is 2GB - 1, not 4000 characters (which is the limit for non-max nvarchar).
Mark WillsTopic AdvisorCommented:
Where are you updating from ?

Doesnt sound like a SQL Server problem as such. As Scott says, even 4000 characters is a doddle for NVARCHAR(MAX)

must be procedural
javier-dAuthor Commented:
We  found out the problem, was related with an Update trigger, with the wrong size.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.