Wednesday, July 2, 2008

TSQL Datatypes

I can't ever seem to remember what the various data type ranges are. So I have linked to a page that seems to have a pretty complete list of them and how much space each takes up. I have also copied a few to this post:

bigint Range: -2^63 (-9,223,372,036,854,775,808) to 2^63-1 (9,223,372,036,854,775,807)
int Range: -2^31 (-2,147,483,648) to 2^31-1 (2,147,483,647)
smallint Range: -2^15 (-32,768) to 2^15-1 (32,767)
tinyint Range: 0 to 255
Byte bit Range: 0 (FALSE) or 1 (TRUE)
bit columns in a table, will be collectively stored as: 1 Byte
9 - 16 bit columns in a table, will be collectively stored as: 2 Bytes, etc.
money Range: -922,337,203,685,477.5808 to 922,337,203,685,477.5807
smallmoney Range: -214,748.3648 to 214,748.3647
float
Range: -1.79E+308 to -2.23E-308, 0 and 2.23E-308 to 1.79E+308
real Range: -3.40E + 38 to -1.18E - 38, 0 and 1.18E - 38 to 3.40E + 38
Note: Real is equivalent to float(24).
datetime Range: January 1, 1753, through December 31, 9999
smalldatetime Range: January 1, 1900, through June 6, 2079
text Maximum length is 2,147,483,647 characters.
ntext Maximum length is 1,073,741,823 characters.
binary & varbinary Maximum length is 8000 bytes.
image Maximum length is 2,147,483,647 bytes.

No comments: