Customization
I use several memory tables to cache data for my site. This is a local web host on my mac and dev server on linux using the php 5.5 mssql library
A simplified table looks like this:
CacheID INT NOT NULL CacheData VARCHAR(MAX)
Sometimes I insert a few large values. 10,000+ characters. The insert works fine. A simple request tells me that all data is in a field:
SELECT CacheID, LEN(CacheData) FROM Caches
Problem
However, when I actually select the data, the cache column is always truncated to 8192 characters, causing problems. Simple choice:
SELECT CacheData FROM Caches WHERE CacheID = 10
I checked the character limit of varchar (max). And it is far beyond 8192. 2^32 - 1
Question
Why is data truncated?
The question is in a different form. I actually came across this Hagian and forgot about this decision. I recalled a little when I forgot the root cause. Here is what I was looking for, thinking that SQL Server was the culprit.
What is the maximum length of a Varchar (MAX) SQL Server? . If your values ββare truncated, it is probably caused by the php non sql server. If you just want to know what max is, this question will be answered: The maximum size of the variable varchar (max)
source share