Below table lists out the major difference between the VARCHAR and NVARCHAR Data Type in Sql Server:
|
Varchar(n)
|
Nvarchar(n)
|
Basic Definition
|
Non-Unicode variable length character data type
|
Unicode variable length character data type. It can store Unicode and
Non-Unicode (e.g. japanese,chinese) character.
|
Number of bytes required by each character
|
It takes one byte per character
|
It takes 2 byte per Unicode/Non-Unicode character
|
Optional Parameter n range
|
Optional Parameter n value can be from 1 to 8000.Can store maximum
8000 Non-Unicode characters.
|
Optional Parameter n value can be from 1 to 4000.Can store maximum
4000 Unicode/Non-Unicode characters
|
Use
|
If we know that data to be stored in the column or variable doesn’t
have any Unicode characters.
|
If we know that the data to be stored in the column or variable can
have Unicode characters.
|
Storage capacity
|
Takes no. of bytes equal to the no. of Characters entered plus two
bytes extra for defining offset.
|
Takes no. of bytes equal to twice the no. of Characters entered plus
two bytes extra for defining offset.
|
No comments:
Post a Comment