Data types in UltraLite

Available data types in UltraLite SQL include:

  • Integer

  • Decimal

  • Floating-point

  • Character

  • Binary

  • Date/time

Note

Domains (user-defined data types) are not supported in UltraLite SQL.

Note

You cannot concatenate LONGVARCHAR and LONGBINARY data types. See String operators.

You can create a host variable with any one of the supported types. UltraLite supports a subset of the data types available in SQL Anywhere. The following are the SQL data types supported in UltraLite databases.

Data type Description

BIT

Boolean values (0 or 1). See BIT data type.

{ CHAR | CHARACTER } ( max-length )

Character data of max-length, in the range of 1-32767 bytes. See CHAR data type.

When evaluating expressions, the maximum length for a temporary character value is 2048 bytes.

VARCHAR ( max-length )

VARCHAR is used for variable-length character data of max-length. See VARCHAR data type.

LONG VARCHAR

Arbitrary length character data. Conditions in SQL statements (such as in the WHERE clause) cannot operate on LONG VARCHAR columns. The only operations allowed on LONG VARCHAR columns are to insert, update, or delete them, or to include them in the select-list of a query. See LONG VARCHAR data type.

You can cast strings to/from LONGVARCHAR data.

[ UNSIGNED ] BIGINT

An integer requiring 8 bytes of storage. See BIGINT data type.

{ DECIMAL | DEC | NUMERIC } ( precision, scale ] ) ]

The representation of a decimal number using two parts: precision (total digits) and scale (digits that follow a decimal point). See DECIMAL data type, NUMERIC data type, UltraLite precision creation parameter, and UltraLite scale creation parameter.

DOUBLE [ PRECISION ]

A double-precision floating-point number. In this data type PRECISION is an optional part of the DOUBLE data type name. See DOUBLE data type.

FLOAT [ ( precision ) ]

A floating-point number, which may be single or double precision. See FLOAT data type.

[ UNSIGNED ] { INT | INTEGER }

An unsigned integer requiring 4 bytes of storage. See INTEGER data type.

REAL

A single-precision floating-point number stored in 4 bytes. See REAL data type.

[ UNSIGNED ] SMALLINT

An integer requiring 2 bytes of storage. See SMALLINT data type.

[ UNSIGNED ] TINYINT

An integer requiring 1 byte of storage. See TINYINT data type.

DATE

A calendar date, such as a year, month, and day. See DATE data type.

TIME

The time of day, containing hour, minute, second, and fraction of a second. See TIME data type.

DATETIME

Identical to TIMESTAMP. See DATETIME data type.

TIMESTAMP

A point in time, containing year, month, day, hour, minute, second, and fraction of a second. See TIMESTAMP data type.

VARBINARY ( max-length )

Identical to BINARY. See VARBINARY data type.

BINARY ( max-length )

Binary data of maximum length max-length bytes. The maximum length should not exceed 2048 bytes. See BINARY data type.

LONG BINARY

Arbitrary length binary data. Conditions in SQL statements (such as in the WHERE clause) cannot operate on LONG BINARY columns. The only operations allowed on LONG BINARY columns are to insert, update, or delete them, or to include them in the select-list of a query. See LONG BINARY data type.

You can cast values to/from LONGBINARY data.

UNIQUEIDENTIFIER

Typically used for a primary key or other unique column to hold UUID (Universally Unique Identifier) values that uniquely identify rows. UltraLite provides functions that generate UUID values. These values are generated so that a value produced on one computer does not match a UUID produced on another computer. UNIQUEIDENTIFIER values generated in this way can therefore be used as keys in a synchronization environment. See UNIQUEIDENTIFIER data type.


User-defined data types and their equivalents
Converting data types explicitly