2. SQL Data Types : Data Types : Varchar Data Type
Share this page                  
Varchar Data Type
Varchar strings are variable-length strings. Varchar strings can contain any character, including non-printing characters, except the ASCII null character ('\0').
If the column is nullable, varchar columns require an additional byte of storage.
Blanks are significant in the varchar data type. For example, the following two varchar strings are not considered equal:
'the store is closed'
If the strings being compared are unequal in length, the shorter string is padded with trailing blanks until it equals the length of the longer string.
For example, consider the following two strings:
'\001' represents one ASCII character (ControlA)
If they are compared as varchar data types, then
'abcd' > 'abcd\001'
because the blank character added to 'abcd' to make the strings the same length has a higher value than ControlA ('\040' is greater than '\001').