Are the 8000 and 4000 character limits on variable-length columns down to the page size?
In SQL Server, a non-max variable-length column can hold up to 8000 characters for the single-byte type and 4000 for the double-byte type. A page is 8 kilobytes, which is 8192 bytes.
The correspondence is close enough that it looks deliberate — 8000 bytes either way, sitting just under the page size with room left over.
Is that actually the reason for the limits, and what is the leftover space for?
@sqlserver_sibel · 2w ago
The leftover — the difference between 8192 and 8000 — is page and row overhead, and it is worth knowing what lives there:
Add those and the usable space for row data is a bit over 8000 bytes, which is where the round number comes from. The limit is set so that a single maximum-length value plus the necessary overhead still fits.
This is also why you can define a table whose columns sum to more than the row limit and get a warning rather than an error — it is legal to define, and it fails only if you actually insert a row that does not fit.
Reply
Report