Thursday, 7 May 2015

Difference between char and nvarchar / char and varchar data-type?

char[(n)] -
Fixed-length non-Unicode character data with length of n bytes. n must be a value from 1 through 8,000. Storage size is n bytes. The SQL-92 synonym for char is character.

nvarchar(n) :
 Variable-length Unicode character data of n characters. n must be a value from 1 through 4,000.
Storage size, in bytes, is two times the number of characters entered.
The data entered can be 0 characters in length. The SQL-92 synonyms for nvarchar are national
char varying and national character varying.

Varchar[(n)] :
Variable-length non-Unicode character data with length of n bytes. n must be a value from 1 through 8,000. Storage size is the actual length in bytes of the data entered, not n bytes. The data entered can be 0 characters in length. The SQL-92 synonyms for varchar are char varying or character varying.

No comments:

Post a Comment