Following are the mainly three types of datatypes widely used.
Numerical
Character
Date
Data Type | Description |
---|---|
char(n) | It is a fixed width character string.The maximum size allowed is 32KB – 1 |
varchar(n) | It is a fixed width character string.The maximum size allowed is 32KB – 1 |
unichar | This is a user-defined data type. It is implemented as a LONG VARCHAR allowing NULL. |
univarchar | Unicode data that is likely to vary greatly in length, comparable to varchar |
nchar(n) | Fixed-length data in multibyte character sets |
nvarchar(n) | Variable-length data in multibyte character sets |
text |
Up to 2,147,483,647 bytes of printable characters on linked lists of data pages |
unitext | Up to 1,073,741,823 Unicode characters on linked lists of data pages |
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 |
int | Whole numbers between -231 and 231 – 1 (-2,147,483,648 and 2,147,483,647), inclusive |
smallint | Whole numbers between -215 and 215 -1 (-32,768 and 32,767), inclusive |
decimal | exact decimal numbers between -1038 and 1038 -1, inclusive. |
numeric | exact decimal numbers between -1038 and 1038 -1, inclusive. |
float | positive or negative floating point numbers. Precision and number of significant digits are machine-dependent. Storage size is 8 bytes. |
real | like float except the storage size is 4 bytes. |
datetime | dates and times of day between January 1, 1753 and December 31, 9999. Storage size is 8 bytes: 4 bytes for the number of days before or after the base date of January 1, 1900, and 4 bytes for the time, to 1/300 second |
smalldatetime | dates and times of day between January 1, 1900 and June 6, 2079, with accuracy to one minute. Storage size is 4 bytes: one small integer for the number of days after January 1, 1900, and one small integer for the number of minutes since midnight |
date | dates between January 1, 0001, and December 31, 9999. Storage size is 4 bytes. Dates before the base date are stored as negative values |
time | time between 12:00:00 AM and 11:59:59.999 PM. Storage size is 4 bytes |
bigtime | time of day, containing hour, minute, second, and fraction of a second corresponding to the TIME datatype in Sybase IQ. The fraction is stored to 6 decimal places. A bigtime value requires 8 bytes of storage. ODBC standards restrict bigtime datatype to an accuracy of seconds |
digdatetime | point in time, containing year, month, day, hour, minute, second, and fraction of a second corresponding to the TIMESTAMP datatype in Sybase IQ. The fraction is stored to 6 decimal places. The day must be a nonzero value. A bigdatetime value requires 8 bytes of storage |
timestamp | uses varbinary(8) as the underlying datatype. A status bit differentiates timestamp from varbinary |