Previous Topic

Next Topic

Storage Formats of Data Types

The following table lists storage formats for SQL data types:

Data Type

Description

Range

char

character

A string of 1 to maximum configured row size but not exceeding 32,000

c

character

A string of 1 to maximum configured row size but not exceeding 32,000.

varchar

character

A string of 1 to maximum configured row size but not exceeding 32,000.

long varchar

character

A string of 1 to 2 GB characters.

text

character

A string of 1 to maximum configured row size but not exceeding 32,000.

nchar

Unicode

A string of 1 to maximum configured row size, but not exceeding 16,000 characters (32,000 bytes).

nvarchar

Unicode

A string of 1 to maximum configured row size, but not exceeding 16,000 characters (32,000 bytes).

long nvarchar

Unicode

A string of 1 to a maximum of 1 GB Unicode characters (that is, 2 bytes to a maximum of 2 GB bytes in length).

tinyint

1-byte integer

-128 to +127

smallint

2-byte integer

-32,768 to +32,767

integer

4-byte integer

-2,147,483,648 to +2,147,483,647.

bigint

8-byte integer

-9,223,372,036,854,775,808 to +9,223,372,036,854,775,807

decimal

fixed-point exact numeric

Depends on precision and scale. Default is (5,0): -99999 to +99999. Maximum number of digits is 31.

float4

4-byte floating

-1.0e+38 to +1.0e+38 (7 digit precision).

float

8-byte floating

-1.0e+38 to +1.0e+38

date

4-byte binary

0001-01-01 to 9999-12-31

time

10-byte binary

00:00:00 to 24:00:00

timestamp

14-byte binary

0001-01-01 00:00:00 to 9999-12-31 24:00:00

interval year to month

3-byte binary

-9999-0 to 9999-11

interval day to second

12-byte binary

-3652047 00:00:00 to 3652047 23:59:59

ingresdate

ingresdate (12 bytes)

1-jan-0001 to 30-dec-9999 (for absolute dates) and -9999 years to +9999 years (for time intervals).

money

money (8 bytes)

$-999,999,999,999.99 to $999,999,999,999.99.

table_key

logical key

No range: stored as 8 bytes.

object_key

logical key

No range: stored as 16 bytes.

byte

binary

Fixed length binary data, 1 to maximum configured row size.

byte varying

binary

Variable length binary data, 1 to maximum configured row size.

long byte

binary

1 to 2 GB of binary data.

Nullable columns require one additional byte to store a null indicator.

Note: If your hardware supports the IEEE standard for floating point numbers, the float type is accurate to 14 decimal precision (-dddddddddddd.dd to +dddddddddddd.dd) and ranges from -10**308 to +10**308. The money type is accurate to 14 decimal precision with or without IEEE support.


© 2007 Ingres Corporation. All rights reserved.