In SQL Server 2008 R2 we are using an updateable view to update a varchar(max)
column. When we update the column with text and then check the number of characters, it is showing a length of 8000 characters, even though the update contains a greater number of characters.
Is there some kind of limit on the number of characters that a view can receive for an update?
Ok I'm working with the application development team on this and they think they found a way around it so they discarded the code they were using as their test case. I'll do my best to give the general idea. The update statement looked something like:
UPDATE vorders
set [description] = '<br> This is some text about the order </br>'
+ CHAR(34) + 'This is more text' + CHAR(34) + 'and on it goes'
where orderid = 12345
We would then check the length of the characters put into the field by running the following query
SELECT LEN([description])
FROM vorders
WHERE orderid = 12345
What the application guys found is that if they remove the + CHAR(34) + part of the code the length would go up to 8700 characters. With the + CHAR(34) + part of the code in it was truncating the text down to 8000 characters. This made me suspect that it was some kind of implicit conversion; however, we found that the truncation did not occur with one or two of the + CHAR(34) + in place. The original statment had something like 30 of them.
Any idea what might be causing this cause I'm at a loss on this one.