T-SQL Tutorial

SQL Server NTEXT


The NTEXT data type in SQL Server is used to store Unicode character data up to a maximum of 2^30 - 1 (1,073,741,823) characters in length. It is the Unicode equivalent of the TEXT data type, which is used to store non-Unicode character data.

The NTEXT data type is part of the larger family of Large Object (LOB) data types in SQL Server, which also includes the VARCHAR(MAX), NVARCHAR(MAX), and VARBINARY(MAX) data types. LOB data types are used to store large amounts of data, which can be up to 2 GB in size.

The NTEXT data type can be used to store data such as text documents, XML documents, and other types of Unicode character data. It is often used in scenarios where text data needs to be stored in a database, such as in content management systems or document management systems.

When working with NTEXT data, it's important to keep in mind that the data type is deprecated in SQL Server and is no longer recommended for use. Instead, it's recommended to use the NVARCHAR(MAX) data type, which provides the same functionality as the NTEXT data type but with improved performance and easier migration to other database platforms.

In addition, it's important to note that the NTEXT data type does not support some operations that are supported by other character data types in SQL Server. For example, it does not support the LIKE operator, and it cannot be used as a key in a clustered index.

Overall, the NTEXT data type is a powerful tool for storing large amounts of Unicode character data in SQL Server. However, due to its limitations and deprecation, it's recommended to use other data types such as NVARCHAR(MAX) instead.