Selecting between varchar and nvarchar

A

ad

When we design a string field, we can use varchar and nvarchar.
There are some field which will have Chinese word.
I will use varchar if the field is just English character or digital.
and use nvarchar if the field may contain Chinese word.

Somebody recommend that it is better to use nvarchar for all string field
for reason of purity.

What is the best policy for selecting between varchar and nvarchar
 
G

Guest

If you must use or allow for Unicode or double-byte characters, such as,
Chinese you have to use nvarchar. Using varchar involves 8-bit characters.
If your applications will only use 8-bit characters varchar is fine.
 
A

ad

Thanks,

There are some fields in my database of pure of English character. and some
fileds may have Chinese in it.
Which one is better.
1. Using Unicode for every string field.
2. Using char/varchr for field of pure English character, using
nchar/nvarchr for fields which may have Chinese character?

"(e-mail address removed)"
 
R

Rahul Arora

Hi..ad,

I think second approach is better, because using NVarchar for every
field will result in more space consumtion in your database as they are
stored 2-byte per character. So u can use varchar for pure english and
nvarchar for fields which have chinese characters.

Rahul Arora
Mindfire Solutions
 
G

Guest

My two cents.... space is cheap compared to the maintenance going forward and
complex logic to deal with different input type. I will stick with nvarchar
for all
 
W

William \(Bill\) Vaughn

Ah, memory is not so cheap--not when you have to share it. The larger your
data sets are, the more room they take in cache. The less rows in cache the
slower your server. When you're counting users per second, the more ASP page
instances you can get in memory at once the more you can serve. DBCS double
the memory consumption of each field they use, double the size of the local
variables that have to handle them, increase the complexity of the code that
has to decode them.

Sure, if you have an application that has to work on a DBCS platform, go for
it. If you need to support multiple languages add DBCS-enabled tables but
don't just go nuts and make all VarChars and Chars NVarChars or NChars.

Yes, more than half of the world uses DBCS but many of the applications
created here in the US and Canada, UK, Australia and New Zealand and many
other countries don't need DBCS support.

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top