SQL Server CLOB Tools - Import, Export, View and Edit

SQL Server doesn’t have a direct equivalent to the traditional CLOB (Character Large Object) data type like some other databases. However, the VARCHAR(MAX) and NVARCHAR(MAX) data types in SQL Server can be used to store large amounts of character data, similar to what a CLOB is used for in other systems. More: SQL Server [TEXT, NTEXT, VARCHAR(MAX), NVARCHAR(MAX)] (CLOB).

SQL Server CLOB - type family and size limits

Type in Microsoft SQL ServerMaximum size
VARCHAR(MAX)up to 2 GB, non-Unicode
NVARCHAR(MAX)up to 2 GB, roughly one billion characters (2 bytes each)
TEXT / NTEXTdeprecated - do not use in new tables

CLOB versus BLOB in Microsoft SQL Server

SQL Server has no types named BLOB or CLOB at all: the equivalents are `VARBINARY(MAX)` for binary and `VARCHAR(MAX)` / `NVARCHAR(MAX)` for text. The `MAX` suffix is what matters - a plain `VARBINARY(n)` tops out at 8,000 bytes.

What limits you first

2 GB per value. Beyond that you have to move to FILESTREAM, which stores the payload in the file system and keeps a pointer in the table. SET TEXTSIZE can also cap how much a single read returns.

CLOB from the command line

Things that bite with CLOB in Microsoft SQL Server