Click to See Complete Forum and Search --> : difference between varchar and nvarchar


Nagham
November 3rd, 2006, 02:30 AM
Hi therenI need to know what is the difference between varchar and nvarchar in SQL 2005 and wich type is preferable...Thx

aniskhan
November 3rd, 2006, 04:55 AM
VarChar
-------
variable length string of ASCII characters.
ASCII characters each take one Byte of space.

NVarChar
--------
is a variable length string of UNICODE characters.
UNICODE characters each take Two Bytes of space.(thus larger field size)

u need nvarchar if you are going to store multilingual characters.

exterminator
November 5th, 2006, 06:00 AM
Its recommended to use NVarChar since in future ASCII may not be supported.Who said so?

aniskhan
November 5th, 2006, 11:32 AM
thanks exterminator
Just smbdy made me believe this on this statement, but after some searching i found.

Use char/varchar columns instead of nchar/nvarchar if you do not need to store unicode data. The char/varchar value uses only one byte to store one character, the nchar/nvarchar value uses two bytes to store one character, so the char/varchar columns use two times less space to store data in comparison with nchar/nvarchar columns.

exterminator
November 5th, 2006, 11:57 AM
thanks exterminator
Just smbdy made me believe this on this statement, but after some searching i found.Cool.. exactly my thought.. :) ;)