Data Types

A column can contain any of the data types discussed in this topic. The following table lists the limits (minimum and maximum values) for each data type in XDB mode. The limits of XDB Server and DB2 data types are identical, except in the cases of float and char types. (See the footnotes in the table). The system rejects, or truncates (depending on the data type) values that fail to satisfy the rules for a data type.

Type Minimum Maximum Storage
Smallint -32,768 32,767 2 bytes
Int[eger] -2,147,483,648 2,147,483,647 4 bytes
float (single)

(See note 1.)

1.2E-38 3.4E+38 4 bytes
float (double)

(See note 1.)

2.2E-308 1.8E+308 8 bytes
Dec[imal] 1-10E+31 10E+31 (precision/2)+1
Money -10E+12 10E+12 8 bytes
DATE 1/1/0001 12/31/9999 6 bytes
TIME 00:00:01 24:00:00 6 bytes
Timestamp 0001-1-01-

00.00.000000

9999-12-31-

24.00.000000

12 bytes
Char(See note 2.) 1 byte 254/4056 bytes

(See note 3.)

n bytes
varchar

(See note 2.)

1 byte 32706 >= n bytes
long varchar

(See note 2.)

1 byte 32706 <= n bytes
Graphic 2 bytes 127 bytes <= n bytes
Vargraphic 2 bytes 16353 <= n bytes
Long Vargraphic 2 bytes 16353 <= n bytes
BLOB(See note 4.) zero bytes 2 GB separate file

Table Notes:

  1. The DB2 limits are 5.4E-79 to 7.2E+75 and 5.4E-79 to 7.2E+75 for single and double precision floating point values respectively.
  2. Can be defined as FOR BIT DATA, which means the column's fields contain a stream of bits that are not to be interpreted as ASCII (or EBCDIC) character codes.
  3. Character fields can store up to 4056 bytes in XDB mode, but only 254 bytes in DB2 mode.
  4. Includes image, binary, varbinary, and long varbinary data types.

More: