C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » SQL Server »

difference between nvarchar and varchar in sqlserver2005


Posted Date: 20 Nov 2008      Posted By: Naresh Yadav      Member Level: Silver     Points: 1   Responses: 3



Actually i have a column(DOB) in database with a datatype nvarchar(50).
and i have passed a value '20/feb/1985'.
it is throwing an error saying " data type char cannot be converted into datetime data type"
but after changing nvarchar(50) datatype of column DOB to Varchar(50) it is working fine.

kindly explain where i gone wrong





Responses

Author: Venkat Tammineni    20 Nov 2008Member Level: GoldRating: 2 out of 52 out of 5     Points: 2

hi,

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.

I hope this helps you.

Thanks
Venkat



Author: Bunty    20 Nov 2008Member Level: DiamondRating: 2 out of 52 out of 5     Points: 3

Hi,

The difference between varchar and nvarchar is that in case of nvarchar we can store unicode characters also means we can store characters of any language like hindi,telugu,urdu,french and so on.

Regards
S.S.Bajoria


Thanks & Regards
S.S.Bajoria



Author: kiran    27 Nov 2008Member Level: SilverRating: 2 out of 52 out of 5     Points: 6

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.



Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.


Next : Need dumps to clear certificate of ms SQL server 2005
Previous : sqlserver versions
Return to Discussion Forum
Post New Message
Category: SQL Server

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use