The varchar(max) Data Type

The varchar(max), nvarchar(max), and varbinary(max) data types are extensions of the varchar, nvarchar, and varbinary data types that can store up to 2 gigabytes (GB) of data. They are alternatives to text, ntext, and image and use the max size specifier. Using one of these data types is easy—you just specify it in your CREATE TABLE statement (or in any variable declaration) with a (max) identifier, as in this example:

CREATE TABLE TableWithMaxColumn
 (Customer_Id int, CustomerLifeStory varchar(max))

All the standard T-SQL string functions operate on varchar(max), including concatenation functions SUBSTRING, LEN, and CONVERT. For example, you can use the T-SQL SUBSTRING function to read parts of the string (chunks), and ...

Get Programming Microsoft® SQL Server™ 2008 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.