The maximum length of the string. If byte-length semantics are used (CHAR or CHARACTER is not specified as part of the length),
then the length is in bytes, and the length must be in the range 1 to 32767. If the length is not specified, then it is 1.
If character-length semantics are used (CHAR or CHARACTER is specified as part of the length), then the length is in characters,
and you must specify max-length. max-length can be a maximum of 32767 characters.
Multibyte characters can be stored as CHAR, but the declared length refers to bytes, not characters, unless character-length
semantics are used.
CHAR can also be specified as CHARACTER. Regardless of which syntax is used, the data type is described as CHAR.
CHAR is semantically equivalent to VARCHAR, although they are different types. In SQL Anywhere, CHAR is a variable-length
type. In other relational database management systems, CHAR is a fixed-length type, and data is padded with blanks to max-length bytes of storage. SQL Anywhere does not blank-pad stored character data.
How CHAR columns are described depends on the client interface, the character sets used, and if character-length semantics
are used. For example, in embedded SQL the described length is the maximum number of bytes in the client character set. If
the described length would be more than 32767 bytes, the column is described as type DT_LONGVARCHAR. The following table shows
some embedded SQL examples and the results returned when a DESCRIBE is performed:
Compatible with SQL/2008. In the standard, character-length semantics are the default, whereas in SQL Anywhere byte-length
semantics are the default. There are minor inconsistencies with the SQL standard due to case-insensitive collation support
and SQL Anywhere's support of blank-padding.
The SQL/2008 standard supports explicit character- or byte-length semantics as SQL language feature T061.