What is the Difference between varchar and nvarchar in SQL Server?

Published on December 12, 2013 by abundantcode

Filed under SQL Server

Last modified December 12, 2013

Print this page

rate 1 star rate 2 star rate 3 star rate 4 star rate 5 star
Your rating: none, Average: 0 (0 votes)

This article have been viewed 3247 times

The SQL Server has the data type varchar and nvarchar . What is the main difference between the both ? Let’s explore it in this article.

What is the Difference between varchar and nvarchar in SQL Server?

varchar is a variable length and non-unicode data type which can take the 8-bit codepage. The collation of the database identifies which of the code page should be used in storing the data.

In contrast , nvarchar is also a variable length datatype which can take unicode character data which means you can store a unicode text / foriegn language text in this column .

One more difference is that the varchar(max) can hold upto 2^31 bytes of data where as nvarchar(max) can hold upto 2^30 bytes of data.

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

Leave a Comment


x

You might be Interested in these Posts

What is the Difference between Readonly and Const in C# ?

If you want to have a field whose value cannot be changed at runtime , you can use either const or r...

Cimbalino Windows Phone Toolkit is now updated to Version 3.2.0

The Cimbalino Windows Phone Toolkit Version 3.2.0 was released few days back which included some of ...

What is the Difference between Repository and Service Layer in ASP.NET MVC?

Repository pattern, Unit of Work and Service Layer is one of the most commonly used word or techniqu...