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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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).

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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-dCIOAuthor Commented:
We  found out the problem, was related with an Update trigger, with the wrong size.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.