NVARCHAR(MAX) VS NTEXT in SQL Server

Here are some differences between nvarchar(max)/nvarchar and ntext in SQL Server


Nvarchar(max)/Nvarchar()


Ntext

Nvarchar(max) is supported only from version 2005 onwardsNtext is available in prior versions too
You can specify the length in advance for nvarchar datatype i.e. nvarchar(100), nvarchar(4000)You can't specify the length for Ntext datatype
All types of string functions such as left, right, len, etc. can be used for Nvarchar data typeOnly limited functions like substring, datalength are used for Ntext datatype
Nvarchar datatype can be used in local variablesNtext can't be used in local variables
Nvarchar datatype is available from version 2005 onwards and will be supported for further releasesNtext will be removed from future release of SQL Server and will be substituted by nvarchar(max) datatype

In one of the upcoming posts, I will tell you how to Convert an Ntext column to Nvarchar(max) and some points to consider while doing so.


About The Author

Madhivanan,an MSc computer Science graduate from Chennai-India, works as a works as a Lead Subject Matter Expert at a company that simplifies BIG data. He started his career as a developer working with Visual Basic 6.0, SQL Server 2000 and Crystal Report 8. As years went by, he started working more on writing queries in SQL Server. He now has good level of knowledge in SQLServer, Oracle, MySQL and PostgreSQL as well. He is also one of the leading posters at www.sqlteam.com and a moderator at www.sql-server-performance.com. His T-sql blog is at http://beyondrelational.com/blogs/madhivanan

No comments: