In SQL Server, there isn’t a data type named BLOB like in some other database systems. However, it offers several data types to store binary data, including VARBINARY, BINARY, and IMAGE (although IMAGE is deprecated as of SQL Server 2005 and should be avoided in new development). More: SQL Server [IMAGE, VARBINARY(MAX)] (BLOB).
| Type in Microsoft SQL Server | Maximum size |
|---|---|
VARBINARY(MAX) | up to 2 GB (the recommended type) |
IMAGE | 2 GB, but deprecated since SQL Server 2005 |
FILESTREAM | for values beyond 2 GB - data lives in the file system |
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