Char Data Type
Char strings are fixed-length strings. Char strings can contain any printing or non-printing character, except the null character ('\0').
In uncompressed tables, char strings are padded with blanks to the declared length. For example, if ABC is entered into a char(5) column, five bytes are represented, as follows:
'ABC '
Leading and embedded blanks are significant when comparing char strings. For example, the following char strings are considered different:
'A B C'
'ABC'
When selecting char strings using the underscore (_) wildcard character of the LIKE predicate, include any trailing blanks to be matched. For example, to select the following char string:
'ABC '
the wildcard specification must also contain trailing blanks:
'_____'
Length is not significant when comparing char strings; the shorter string is (logically) padded to the length of the longer. For example, the following char strings are considered equal:
'ABC'
'ABC '
Note: A synonym for char is character.
Last modified date: 06/28/2024