Character Data Types

Use character data types for storing strings of letters, numbers and symbols.

Syntax

Use this syntax for character data types.

CHAR [ ( max-length ) ]
CHARACTER [ ( max-length ) ]
CHARACTER VARYING [ ( max-length ) ]
VARCHAR [ ( max-length ) ]
UNIQUEIDENTIFIERSTR

Usage

This table describes the character data types.

Character Data Type

Character Data Type

Description

CHAR

Character data of maximum length max-length bytes. If max-length is omitted, the default is 1. The maximum size allowed is 32KB – 1. See Notes for restrictions on CHAR data greater than 255 bytes.

See the notes below on character data representation in the database, and on storage of long strings.

All CHAR values are blank padded up to max-length, regardless of whether the BLANK PADDING option is specified. When multibyte character strings are held as a CHAR type, the maximum length is still in bytes, not characters.

CHARACTER

Same as CHAR.

CHARACTER VARYING

Same as VARCHAR.

LONG VARCHAR

Arbitrary length character data. The maximum size is limited by the maximum size of the database file (currently 2 gigabytes).

TEXT

This is a user-defined data type. It is implemented as a LONG VARCHAR allowing NULL.

VARCHAR

Same as CHAR, except that no blank padding is added to the storage of these strings, and VARCHAR strings can have a maximum length of (32KB – 1). See Notes for restrictions on VARCHAR data greater than 255 bytes.

UNIQUEIDENTIFIERSTR

Domain implemented as CHAR( 36 ). This data type is used for remote data access, when mapping Microsoft SQL Server uniqueidentifier columns.

Note: As a separately licensed option, SAP Sybase IQ supports character large object (CLOB) data with a length ranging from zero (0) to 512TB (terabytes) for an SAP Sybase IQ page size of 128KB or 2PB (petabytes) for an SAP Sybase IQ page size of 512KB. The maximum length is equal to 4GB multiplied by the database page size. See Unstructured Data Analytics.
Related concepts
Binary Data Types
Character Data Type Compatibility
Related reference
Binary Data Types
NEWID Function [Miscellaneous]
STRTOUUID Function [String]
UUIDTOSTR Function [String]