Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Varchar vs. NVarchar

Author  Topic 

label
Posting Yak Master

197 Posts

Posted - 2003-04-14 : 14:00:20
I've always wondered what the difference between varchar and nvarchar types are and which one is better and why?

I've read the definition for each type in the SQL Help section but I'm not sure I understood which type is used for what and when.

Thanks.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-04-14 : 14:16:08
From BOL:

"Sites supporting multiple languages should consider using the Unicode nchar or nvarchar data types to minimize character conversion issues."

nvarchar can be used instead of varchar, but it should definitely be used when you are supporting multiple languages and character conversions.

HTH,

Tara
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2003-04-14 : 14:19:22
....or should be avoided if you are not doing international language translations, since it will double the size of your database.



Brett

8-)
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-04-14 : 14:24:36
quote:

....or should be avoided if you are not doing international language translations, since it will double the size of your database.



Yes, that's why I said CAN BE USED, but I should have been clearer. Thanks for pointing it out since it is important to know if you want to understand the differences between the two.

Tara
Go to Top of Page

label
Posting Yak Master

197 Posts

Posted - 2003-04-14 : 16:12:16
Ok, so then if I'm not having to worry about converting my data to a different langauge at some point, I should use Varchar then?

That's currently what I'm using but I want to make sure what I'm doing is the best way to do it.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-04-14 : 16:13:08
Yes, use varchar.

Tara
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2003-04-14 : 16:18:07
....and, even if you had to convert. You could. Easily.

DECLARE @x varchar(255)
SELECT CONVERT(nvarchar(255),@x)



Brett

8-)
Go to Top of Page

label
Posting Yak Master

197 Posts

Posted - 2003-04-14 : 17:15:44
Cool. Thanks guys.

Go to Top of Page
   

- Advertisement -