Friday, September 21, 2012

Almost all of us used char, varchar and nvarchar datatype while designing a database table in sql but only few among us knows the exact difference between these three. That's why let me differentiate these three important datatypes and I hope it will help you all.

Char DataType: 
Char datatype which is used to store fixed length of characters. Suppose if we declared char(50) it will allocates memory for 50 characters. Once we declare char(50) and insert only 10 characters of word then only 10 characters of memory will be used and other 40 characters of memory will be wasted.

varchar DataType: 
Varchar means variable characters and it is used to store non-unicode characters. It will allocate the memory based on number of characters inserted. Suppose if we declared varchar(50) it will allocates memory of 0 characters at the time of declaration. Once we declare varchar(50) and insert only 10 characters of word it will allocate memory for only 10 characters.

nvarchar DataType:
nvarchar datatype same as varchar datatype but only difference nvarchar is used to store Unicode characters and it allows you to store multiple languages in database. nvarchar datatype will take twice as much space to store extended set of characters as required by other languages.


Anonymous said...

The grid provides broad capabilities of working with data such as arbitrary class objects, row arrays, objects implementing IList or IDictionary interfaces and objects with variable number of can read more detail about data type visit dapfor. com

Post a Comment