Adaptive Server provides the following exact numeric datatypes to store integers: bigint, int (or integer), smallint, tinyint and each of their unsigned counterparts. Choose the integer type based on the expected size of the numbers to be stored. Internal storage size varies by type, as shown in Table 1-6.
Datatype |
Stores |
Bytes of storage |
---|---|---|
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. |
8 |
int[eger] |
Whole numbers between-231 and 231 - 1 (-2,147,483,648 and 2,147,483,647), inclusive. |
4 |
smallint |
Whole numbers between -215 and 215 -1 (-32,768 and 32,767), inclusive. |
2 |
tinyint |
Whole numbers between 0 and 255, inclusive. (Negative numbers are not permitted.) |
1 |
unsigned bigint |
Whole numbers between 0 and 18,446,744,073,709,551,615 |
8 |
unsigned int |
Whole numbers between 0 and 4,294,967,295 |
4 |
unsigned smallint |
Whole numbers between 0 and 65,535 |
2 |
Enter integer data as a string of digits without commas. Integer data can include a decimal point as long as all digits to the right of the decimal point are zeros. The smallint, integer, and bigint datatypes can be preceded by an optional plus or minus sign. The tinyint datatype can be preceded by an optional plus sign.
Table 1-7 shows some valid entries for a column with a datatype of integer and indicates how isql displays these values:
Value entered |
Value displayed |
---|---|
2 |
2 |
+2 |
2 |
-2 |
-2 |
2. |
2 |
2.000 |
2 |
Table 1-8 lists some invalid entries for an integer column:
Value entered |
Type of error |
---|---|
2,000 |
Commas not allowed. |
2- |
Minus sign should precede digits. |
3.45 |
Digits to the right of the decimal point are nonzero digits. |