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 2005 Forums
 Transact-SQL (2005)
 Difference between varchar and nvarchar

Author  Topic 

cplusplus
Aged Yak Warrior

567 Posts

Posted - 2008-01-03 : 12:17:11
I have a field with ntext datatype and changed to varchar 8000, but when i tried to use nvarchar: it gave message saying max length can be only 4000.

but if i use just varchar it did allow upto 8000.

what is the difference between using varchar & nvarchar., in terms of inputting/writing data to that cell.

Thanks...

X002548
Not Just a Number

15586 Posts

Posted - 2008-01-03 : 12:20:22
n means it's unicode, which holds twice as many bytes for language support

you sure you're on 2k5?



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-01-03 : 12:24:33
The nvarchar data type provides support for Unicode characters. This is needed if you are building an international system that must store different languages. However, if you have no need to store Unicode characters then you are better using varchar. The nvarchar data type occupies twice the space of varchar as it uses 2 bytes to encode each character.
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2008-01-03 : 12:56:32
what he said

And if it really is 2k5, look up varchar(max) in Books Online



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page
   

- Advertisement -