Char
Ø Char is fixed length character data
Ø
Non-Unicode fixes
Length character data type.
Ø
It takes fix
length.
Ø
Optional
Parameter n value can be from 1 to 8000.Can store maximum 8000 Non-Unicode
characters.
Ø
If we know the
fix size of the column then we use char. Like zip code is fix length.
Varchar
Ø Varchar is variable length character data.
Ø
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 we know that
data to be stored in the column or variable doesn’t have any Unicode
characters. then we use Varchar
Nvarchar
Ø Nvarchar is for storing multi language characters
Ø
Unicode Variable Length character data type. It can store both non-Unicode and
Unicode (i.e. Hindi, Tamil 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 we know that
the data to be stored in the column or variable can have Unicode characters.
Then we use Nvarchar
No comments:
Post a Comment
If you have any doubt, please let me know.