difference between varchar and nvarchar datatype ?

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.

varchar :


Non-Unicode Variable Length character data type.
It takes 1 byte per character.
optional Parameter n value can be from 1 to 8000.Can store maximum 8000 Non-Unicode characters.
If Optional parameter value nis not specified in the variable declaration or column definition then it is considered.
If we know that data to be stored in the column or variable doesn’t have any Unicode characters.
When this optional parameter n is not specified while using the CAST/CONVERT functions, then it is considered as 30.

 

nvarchar :

UNicode Variable Length character data type. It can store both non-Unicode and Unicode (i.e. Japanese, Korean etc) characters.
It takes 2 bytes per Unicode/Non-Unicode character.
 optional Parameter n value can be from 1 to 4000.Can store maximum 4000 Unicode/Non-Unicode characters.
If Optional parameter value n is not specified in the variable declaration or column definition then it is considered as 1.
When this optional parameter n is not specified while using the CAST CONVERT functions, then it is considered as 30.

 More Details :  Live Training in jaipur

No comments:

Post a Comment