User Id :    Password :      New Member   Forgot Password  
Topic: Difference between varchar and nvarchar?
Anamika singh
23 Nov 2010 at 01:52 AM
Difference between varchar and nvarchar?
Re: Difference between varchar and nvarchar?
Gaurav
16 Dec 2010 at 04:00 AM
VARCHAR is an abbreviation for variable-length character string. It's a string of text characters that can be as large as the page size for the database table holding the column in question. The size for a table page is 8,196 bytes, and no one row in a table can be more than 8,060 characters. This in turn limits the maximum size of a VARCHAR to 8,000 bytes.
The "N" in NVARCHAR means uNicode. Essentially, NVARCHAR is nothing more than a VARCHAR that supports two-byte characters. The most common use for this sort of thing is to store character data that is a mixture of English and non-English symbols — in my case, English and Japanese.
The key difference between the two data types is how they're stored. VARCHAR is stored as regular 8-bit data. But NVARCHAR strings are stored in the database as UTF-16 — 16 bits or two bytes per character.
Ex: varchar/nvarchar(10) with a value of 'JACK' only stores the 4 characters. Where as char/nchar(10) will pad 'JACK' with 6 spaces to fill out the fixed length string.

Total Replies: 1
 
Featured Text Ad

Featured Ad