Monday 11 April 2011

DDL : Sybase data types

data type storage range/length comments
----------------- -------- ------------------- ----------------------------
integer 4 +/- 2.1 billion
smallint 2 +/- 32768
tinyint 1 0 .. 255
float 4 storage req is machine dependant
real 4
double precision 8
smallmoney 4 +/- 214,748 4 decimal places
money 8 +/- 922 trillion 4 decimal places
decimal/numeric varies
decimal(9,0) 4
decimal(12,0) 5

char(n) n length <= 255
varchar(n) varies length <= 255 ( over 4000 allowed in ASE 12.5 )

text varies length up to 2 GB 16 bytes stored in record (default)
image varies length up to 2 GB 16 bytes stored in record (default)

datetime 8 1/1/1753 .. 12/31/9999 precision to 1/300 second
smalldatetime 4 1/1/1900 .. 6/6/2079 precision to minutes
timestamp 8 same as varbinary(8)

bit 1 0/1 up to 8 bit fields stored within 1 byte

binary(n) length n
varbinary(n) length n


Only numeric data types with a precision of zero can be used for an identity column.

Historical Note on the Datetime Datatype

It starts with 1753 because the English-speaking world converted from the
Julian to the Gregorian calendar in 1752. To do that, the day after September 2, 1752
was decreed to be September 14, 1752.

No comments:

Post a Comment