Character data types

Character data types are used to store strings of letters, numbers, and other symbols.

SQL Anywhere provides two classes of character data types and some domains defined using those types.

  • CHAR, VARCHAR, LONG VARCHAR   Character data stored in a single- or multibyte character set, often chosen to correspond most closely to the primary language or languages stored in the database.

  • NCHAR, NVARCHAR, LONG NVARCHAR   Character data stored in Unicode's UTF-8 encoding. All Unicode code points can be stored using these types, regardless of the primary language or languages stored in the database.

  • TEXT, UNIQUEIDENTIFIERSTR, XML   Domains based on other character data types.

Storage

All character data values are stored in the same manner. By default, values up to 128 bytes are stored in a single piece. Values longer than 128 bytes are stored with a 4-byte prefix kept locally on the database page and the full value stored in one or more other database pages. These default sizes are controlled by the INLINE and PREFIX clauses of the CREATE TABLE statement.

See also

CHAR data type
LONG NVARCHAR data type
LONG VARCHAR data type
NCHAR data type
NTEXT data type
NVARCHAR data type
TEXT data type
UNIQUEIDENTIFIERSTR data type
VARCHAR data type
XML data type