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 of 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 VARCHAR, but the declared length refers to bytes, not characters.
VARCHAR can also be specified as CHAR VARYING or CHARACTER VARYING. Regardless of which syntax is used, the data type is described
How VARCHAR 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.