Exact Numeric Types: Integers

SAP ASE provides various datatypes for storing integers (whole numbers). These types are exact numeric types, which means they preserve their accuracy during arithmetic operations.

Choose among the integer types based on the expected size of the numbers to be stored. Internal storage size varies by datatype.

Implicit conversion from any integer type to a different integer type is supported only if the value is within the range of the type being converted to.

Unsigned integer datatypes allow you to extend the range of the positive numbers for the existing integer types without increasing the required storage size. That is, the signed versions of these datatypes extend both in the negative direction and the positive direction (for example, from -32 to +32). However, the unsigned versions extend only in the positive direction.

Datatype

Range of Signed Datatypes

Datatype

Range of Unsigned Datatypes

bigint

Whole numbers between -263 and 263 - 1 (from -9,223,372,036,854,775,808 to +9,223,372,036,854,775,807, inclusive

unsigned bigint

Whole numbers between 0 and 18,446,744,073,709,551,615

int

Whole numbers between -231 and 231 - 1 (-2,147,483,648 and 2,147,483,647), inclusive

unsigned int

Whole numbers between 0 and 4,294,967,295

smallint

Whole numbers between -215 and 215 -1 (-32,768 and 32,767), inclusive

unsigned smallint

Whole numbers between 0 and 65535