GeekInterview.com
Series: Subject: Topic:
Question: 255 of 429

What is difference between Varchar2 and Nvarchar2?

Asked by: Interview Candidate | Asked on: Sep 6th, 2006
Showing Answers 1 - 3 of 3 Answers
Sibi John

Answered On : Sep 11th, 2006

Varchar2(s) is used to define a variable length character of maximum size s.Nvarchar2: Same as VARCHAR2 except that the column stores values in the  National CS , ie you can store values in Bangla if your National CS is BN8BSCII .If the National CS is of fixed width CS (all characters are represented by a fixed byte ,say 2 bytes for JA16EUCFIXED) , then NVARCHAR2(30) stores 30 Characters.If the National CS is of variable width CS (some characters are represented by 1 byte ,some by 2 bytes as in UTF8 ) , then NVARCHAR2(30) stores 30 bytes.The maximum column size allowed is 4000 bytes. Ex: CREATE TABLE tab1 (col1 NVARCHAR2(2000)); will create a table with one NVARCHAR2 column of 2000 characters in length (stored as 4000 bytes, because each character takes two bytes) using JA16EUCFIXED as the national character set:  

  
Login to rate this answer.
Jai Prakash Vishwakarma

Answered On : Sep 12th, 2006

SQL Server provides both datatypes to store character information. For the most part the two datatypes are identical in how you would work with them within SQL Server or from an application. The difference is that nvarchar is used to store unicode data, which is used to store multilingual data in your database tables. Other languages have an extended set of character codes that need to be saved and this datatype allows for this extension. If your database will not be storing multilingual data you should use the varchar datatype instead. The reason for this is that nvarchar takes twice as much space as varchar, this is because of the need to store the extended character codes for other languages.

  
Login to rate this answer.
mukeshkoshym

Answered On : Nov 26th, 2009

View all answers by mukeshkoshym

In simpleVarchar2 works with 8 bit characters where as Nvarchar2 works ith 16 bit characters.If you have to store data other than english prefer Nvarchar2 or viceversa.

  
Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.