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).
| Type in Microsoft SQL Server | Maximum size |
|---|---|
VARCHAR(MAX) | up to 2 GB, non-Unicode |
NVARCHAR(MAX) | up to 2 GB, roughly one billion characters (2 bytes each) |
TEXT / NTEXT | deprecated - do not use in new tables |
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.
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.
bcp "SELECT * FROM t" queryout out.dat -T -wbcp t in in.dat -T -w or OPENROWSET(BULK ...)VARBINARY(n) or VARCHAR(n) instead of (MAX) caps the column at 8,000 bytes and truncates anything longerNVARCHAR(MAX) stores two bytes per character, so its "2 GB" is about one billion characters, not two billionIMAGE, TEXT and NTEXT are deprecated - use the *MAX typesmax text repl size setting long before the type limit