Home > DeveloperSection > Blogs > Difference between char, varchar and nvarchar in sql server

Difference between char, varchar and nvarchar in sql server

on    April-05-2013 9:08 AM

Database Database 
0 Comment(s)
 3959  View(s)
Rate this:

Difference between char, varchar and nvarchar in sql server

char, varchar and nvarchar are SQL Server data type that used for allocated memory in storage device. But there is little difference between them which described below:


It stores fixed length of character. For example if you declare char (10) then it allocates memory for 10 characters. If you store 5 character words then it stores it in 5 characters memory location and other 5 character's memory location will be wasted. Per character, it takes 1 Byte memory.


varchar is flexible data type means it allocates memory as per data stored into this. If you specify varchar(10) at the time of declaration then it allocates 0 memory location at the starting if you specify, it can be null. When you store 5 characters word it will allocate memory for 5 characters and store into that. So there will be no memory loss. It stores only non-unicode characters means for English language only. Per character, it takes 1 Bytes memory.


nvarchar means unicode variable characters. When you want to store international character in database then used nvarhcar. It used really because it increases database size twice than varchar datatype because it takes 2 Bytes memory for each character.

Recent Activities

Tarun Kumar added new Question Define Event Loop   yesterday

Tarun Kumar added new Article iOS : Sample on UIWebView controller   8 days ago

Don't want to miss updates? Please click the below button!