Reputation: 466
The SQL Server Documentation on Storage and Row Size limit of 8060 Bytes says
The length of individual columns must still fall within the limit of 8,000 bytes for varchar, nvarchar, varbinary, sql_variant, and CLR user-defined type columns. Only their combined lengths can exceed the 8,060-byte row limit of a table.
Please someone explain and help me understand:
Upvotes: 2
Views: 1142
Reputation: 521904
The length restriction must refer to the data length, and not the actual text length. For different encodings, two strings of the same length may have a different size.
For VARCHAR
and the other types mentioned (not including NVARCHAR(MAX)
), each column is limited to 8060 bytes, but the sum of several such columns may still exceed 8060 bytes.
Regarding the apparent contradiction for NVARCHAR(MAX)
, the link you gave goes on to add a note:
This restriction does not apply to varchar(max), nvarchar(max), varbinary(max), text, image, or xml columns. For more information about the storage of these columns, see Using Large-Value Data Types, Using text and image Data, and Using XML Data.
Upvotes: 1