SET TEXTSIZE (Transact-SQL)

**APPLIES TO:** ![yes](media/yes.png)SQL Server (starting with 2008) ![yes](media/yes.png)Azure SQL Database ![yes](media/yes.png)Azure SQL Data Warehouse ![yes](media/yes.png)Parallel Data Warehouse

Specifies the size of varchar(max), nvarchar(max), varbinary(max), text, ntext, and image data returned by a SELECT statement.

[!IMPORTANT]
ntext, text, and image data types will be removed in a future version of Microsoft ssNoVersion]. Avoid using these data types in new development work, and plan to modify applications that currently use them. Use nvarchar(max), varchar(max), and varbinary(max) instead.

Topic link icon Transact-SQL Syntax Conventions

Syntax

SET TEXTSIZE { number }   

Arguments

number
Is the length of varchar(max), nvarchar(max), varbinary(max), text, ntext, or image data, in bytes. number is an integer with a maximum value of 2147483647 (2 GB). A value of -1 indicates unlimited size. A value of 0 resets the size to the default value of 4 KB.

The SQL Server Native Client (10.0 and higher) and ODBC Driver for SQL Server SQL Server automatically specify -1 (unlimited) when connecting.

Drivers older than [!INCLUDEssNoVersion] 2008: The SQL Server Native Client ODBC driver and SQL Server SQL Server Native Client OLE DB Provider (version 9) for SQL Server SQL Server SQL Server automatically set TEXTSIZE to 2147483647 when connecting.

Remarks

Setting SET TEXTSIZE affects the @@TEXTSIZE function.

The setting of set TEXTSIZE is set at execute or run time and not at parse time.

Permissions

Requires membership in the public role.

See Also

[@@TEXTSIZE (Transact-SQL)](../../t-sql/functions/textsize-transact-sql.md)
Data Types (Transact-SQL)
SET Statements (Transact-SQL)