interviews.dotnetthread.com

↑ Grab this Headline Animator

Tuesday, July 22, 2008

Difference between VARCHAR and NVARCHAR.

The big difference between VARCHAR and NVARCHAR is a matter of need.
VARCHAR is stored as regular 8-bit data. However NVARCHAR strings are stored in the database as UTF-16 — 16 bits or two bytes per character, all the time — and converted to whatever codepage is being used by the database connection on output (typically UTF-8). That said, NVARCHAR strings have the same length restrictions as their VARCHAR cousins — 8,000 bytes. However, since NVARCHARs use two bytes for each character, that means a given NVARCHAR can only hold 4,000 characters (not bytes) maximum. So, the amount of storage needed for NVARCHAR entities is going to be twice whatever you'd allocate for a plain old VARCHAR.

Read complete Article Here

Submit this story to DotNetKicks

No comments:

Post a Comment

Post your comments/questions/feedback for this Article.

 

Latest Articles