Skip to content

Commit 85c64ec

Browse files
authored
Merge pull request #33836 from rwestMSFT/rw-0417-fix-10069
Add limitation to TEXTSIZE and refresh article (PR 10069)
2 parents d45ee51 + 1baf093 commit 85c64ec

File tree

1 file changed

+41
-36
lines changed

1 file changed

+41
-36
lines changed
Lines changed: 41 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
---
22
title: "SET TEXTSIZE (Transact-SQL)"
3-
description: SET TEXTSIZE (Transact-SQL)
3+
description: Specifies the size, in bytes, of various data types returned to the client by a SELECT statement.
44
author: WilliamDAssafMSFT
55
ms.author: wiassaf
6-
ms.date: "04/12/2016"
6+
ms.reviewer: randolphwest
7+
ms.date: 04/17/2025
78
ms.service: sql
89
ms.subservice: t-sql
910
ms.topic: reference
@@ -20,43 +21,47 @@ helpviewer_keywords:
2021
- "text size returned [SQL Server]"
2122
dev_langs:
2223
- "TSQL"
23-
monikerRange: ">=aps-pdw-2016||=azuresqldb-current||=azure-sqldw-latest||>=sql-server-2016||>=sql-server-linux-2017||=azuresqldb-mi-current"
24+
monikerRange: ">=aps-pdw-2016 || =azuresqldb-current || =azure-sqldw-latest || >=sql-server-2016 || >=sql-server-linux-2017 || =azuresqldb-mi-current"
2425
---
2526
# SET TEXTSIZE (Transact-SQL)
27+
2628
[!INCLUDE [sql-asdb-asdbmi-asa-pdw](../../includes/applies-to-version/sql-asdb-asdbmi-asa-pdw.md)]
2729

28-
Specifies the size, in bytes, of **varchar(max)**, **nvarchar(max)**, **varbinary(max)**, **text**, **ntext**, and **image** data returned to the client by a SELECT statement.
29-
30-
> [!IMPORTANT]
31-
> **ntext**, **text**, and **image** data types will be removed in a future version of [!INCLUDE[msCoName](../../includes/msconame-md.md)] [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)]. 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.
32-
33-
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: [Transact-SQL syntax conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md)
34-
35-
## Syntax
36-
30+
Specifies the size, in bytes, of **varchar(max)**, **nvarchar(max)**, **varbinary(max)**, **text**, **ntext**, and **image** data returned to the client by a `SELECT` statement.
31+
32+
> [!IMPORTANT]
33+
> **ntext**, **text**, and **image** data types will be removed in a future version of [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)]. 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.
34+
35+
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: [Transact-SQL syntax conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md)
36+
37+
## Syntax
38+
3739
```syntaxsql
38-
SET TEXTSIZE { number }
39-
```
40-
40+
SET TEXTSIZE { number }
41+
```
42+
4143
## Arguments
42-
*number*
43-
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.
44-
45-
The [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] Native Client (10.0 and higher) and ODBC Driver for [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] automatically specify `-1` (unlimited) when connecting.
46-
47-
**Drivers older than [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] 2008:** The [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] Native Client ODBC driver and [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] Native Client OLE DB Provider (version 9) for [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] automatically set TEXTSIZE to 2147483647 when connecting.
48-
49-
## Remarks
50-
Setting SET TEXTSIZE affects the @@TEXTSIZE function.
51-
52-
The setting of set TEXTSIZE is set at execute or run time and not at parse time.
53-
54-
## Permissions
55-
Requires membership in the **public** role.
56-
57-
## See Also
58-
[@@TEXTSIZE (Transact-SQL)](../../t-sql/functions/textsize-transact-sql.md)
59-
[Data Types (Transact-SQL)](../../t-sql/data-types/data-types-transact-sql.md)
60-
[SET Statements (Transact-SQL)](../../t-sql/statements/set-statements-transact-sql.md)
61-
62-
44+
45+
#### *number*
46+
47+
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.
48+
49+
The [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] Native Client (10.0 and higher) and ODBC Driver for [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] automatically specify `-1` (unlimited) when connecting.
50+
51+
## Remarks
52+
53+
Setting `SET TEXTSIZE` affects the `@@TEXTSIZE` function.
54+
55+
The setting of set `TEXTSIZE` is set at execute or run time and not at parse time.
56+
57+
For more information, see [Manage Transact-SQL job steps](/ssms/agent/manage-job-steps#transact-sql-job-steps).
58+
59+
## Permissions
60+
61+
Requires membership in the **public** role.
62+
63+
## Related content
64+
65+
- [@@TEXTSIZE (Transact-SQL)](../functions/textsize-transact-sql.md)
66+
- [Data types (Transact-SQL)](../data-types/data-types-transact-sql.md)
67+
- [SET Statements (Transact-SQL)](set-statements-transact-sql.md)

0 commit comments

Comments
 (0)