ntext、text 和 image (Transact-SQL)ntext, text, and image (Transact-SQL)

本主題適用於:是SQL Server (從 2008 開始)是Azure SQL Database否Azure SQL 資料倉儲 否平行處理資料倉儲 THIS TOPIC APPLIES TO:yesSQL Server (starting with 2008)yesAzure SQL DatabasenoAzure SQL Data Warehouse noParallel Data Warehouse

用來儲存非 Unicode 字元和 Unicode 字元及二進位資料的固定和可變長度資料類型。Fixed and variable-length data types for storing large non-Unicode and Unicode character and binary data. Unicode 資料使用 UNICODE UCS-2 字元集。Unicode data uses the UNICODE UCS-2 character set.

重要!IMPORTANT! ntext文字,和映像SQL Server 的未來版本將移除的資料型別。ntext, text, and image data types will be removed in a future version of SQL Server. 請避免在新的開發工作中使用這些資料類型,並規劃修改目前在使用這些資料類型的應用程式。Avoid using these data types in new development work, and plan to modify applications that currently use them. 請改用 nvarchar(max)varchar(max)varbinary(max)Use nvarchar(max), varchar(max), and varbinary(max) instead.

引數Arguments

ntextntext
最大字串長度為 2^30 - 1 (1,073,741,823) 位元組的可變長度 Unicode 資料。Variable-length Unicode data with a maximum string length of 2^30 - 1 (1,073,741,823) bytes. 儲存體大小 (以位元組為單位) 是輸入字串長度的兩倍。Storage size, in bytes, is two times the string length that is entered. ISO 同義字ntext國家 (地區) 的文字The ISO synonym for ntext is national text.

texttext
在伺服器字碼頁中、最大字串長度為 2^31-1 (2,147,483,647) 的可變長度非 Unicode 資料。Variable-length non-Unicode data in the code page of the server and with a maximum string length of 2^31-1 (2,147,483,647). 當伺服器字碼頁使用雙位元組字元時,儲存體大小仍是 2,147,483,647 個位元組。When the server code page uses double-byte characters, the storage is still 2,147,483,647 bytes. 儲存體大小有可能少於 2,147,483,647 個位元組,這會隨著字元字串而不同。Depending on the character string, the storage size may be less than 2,147,483,647 bytes.

imageimage
0 到 2^31-1 (2,147,483,647) 位元組的可變長度二進位資料。Variable-length binary data from 0 through 2^31-1 (2,147,483,647) bytes.

備註Remarks

下列函數和陳述式可以搭配ntext文字,或映像資料。The following functions and statements can be used with ntext, text, or image data.

函數Functions 陳述式Statements
DATALENGTH (TRANSACT-SQL )DATALENGTH (Transact-SQL) READTEXT (TRANSACT-SQL )READTEXT (Transact-SQL)
PATINDEX (TRANSACT-SQL )PATINDEX (Transact-SQL) SET TEXTSIZE (TRANSACT-SQL )SET TEXTSIZE (Transact-SQL)
子字串 (TRANSACT-SQL )SUBSTRING (Transact-SQL) UPDATETEXT (TRANSACT-SQL )UPDATETEXT (Transact-SQL)
TEXTPTR (TRANSACT-SQL )TEXTPTR (Transact-SQL) WRITETEXT (Transact-SQL)WRITETEXT (Transact-SQL)
TEXTVALID (TRANSACT-SQL )TEXTVALID (Transact-SQL)

另請參閱See also

CAST 和 CONVERT (Transact-SQL)CAST and CONVERT (Transact-SQL)
資料類型轉換 ( Database Engine )Data Type Conversion (Database Engine)
資料類型 (Transact-SQL)Data Types (Transact-SQL)
像 (TRANSACT-SQL )LIKE (Transact-SQL)
SET @local_variable (Transact-SQL)SET @local_variable (Transact-SQL)
定序與 Unicode 支援Collation and Unicode Support