Thursday, April 5, 2012

Difference between VARCHAR and NVARCHAR

The data type Varchar and Nvarchar are the sql server data types, both will used to store the string values.

The abbreviation for Varchar is Variable Length character String.
The abbreviation of Nvarchar is uNicode Variable Length character String.

The Varchar allocates single byte for a character. So can be used to store for 8000 characters in this datatype.

The NVarchar allocates two bytes for a character. Because this Nvarchar type allows to store the special characters. So can be used to store for 4000 characters in this types.

If you want to store more length of uNicode string, the you have to go for the TEXT and NTEXT data types. These are the BLOB( Binary Large Objects) datatypes.

Use Varchar and Nvarchar instead of TEXT and NTEXT as regular. The the later datatypes in unavoidable times.
 

0 comments:

Post a Comment