![]() | ![]() |
Home |
|
|
Reference Manual |
|
| Chapter 1: System and User-Defined Datatypes |
|
| Range and Storage Size |
Table 1-2 lists the system-supplied datatypes and their synonyms and provides information about the range of valid values and storage size for each. For simplicity, the datatypes are printed in lowercase characters, although Adaptive Server allows you to use either uppercase or lowercase characters for system datatypes. User-defined datatypes, such as timestamp, are case sensitive. Most Adaptive Server-supplied datatypes are not reserved words and can be used to name other objects
Datatypes | Synonyms | Range | Bytes of Storage |
|---|---|---|---|
Exact numeric datatypes | |||
tinyint smallint int | integer | 0 to 255 -215 (-32,768) to 215 -1 (32,767) -231 (-2,147,483,648) to | 1 2 4 |
numeric (p, s) decimal (p, s) | dec | -1038 to 1038 -1 -1038 to 1038 -1 | 2 to 17 2 to 17 |
Approximate numeric datatypes | |||
float (precision) double precision real | Machine dependent Machine dependent Machine dependent | 4 or 8 8 4 | |
Money datatypes | |||
smallmoney money | -214,748.3648 to 214,748.3647 -922,337,203,685,477.5808 to | 4 8 | |
Date/time datatypes | |||
smalldatetime datetime | January 1, 1900 to June 6, 2079 January 1, 1753 to | 4 8 | |
Character datatypes | |||
char(n) | character | 255 characters or fewer | n |
varchar(n) | char[acter] varying | 255 characters or fewer | actual entry length |
nchar(n) | national char[acter] | 255 characters or fewer | n * @@ncharsize |
nvarchar(n) | nchar varying, national char[acter] varying | 255 characters or fewer | n |
Binary datatypes | |||
binary(n) varbinary(n) | 255 bytes or fewer 255 bytes or fewer | n actual entry length | |
Bit datatype | |||
bit | 0 or 1 | 1 (1 byte holds up to 8 bit columns) | |
Text and image datatypes | |||
text | 231 -1 (2,147,483,647) bytes or fewer | 0 until initialized, then a multiple of 2K | |
image | 231 -1 (2,147,483,647) bytes or fewer | 0 until initialized, then a multiple of 2K | |
|
|