Tuesday, 9 October 2012

SQL SERVER DATA TYPES





Datatype
Min
Max
Storage
Bigint
-2^63
2^63-1
8 bytes
Int
-2,147,483,648
2,147,483,647
4 bytes
Smallint
-32,768
32,767
2 bytes
Tinyint
0
255
1 bytes
Bit
0
1
1 to 8 bit columns in the same table requires a total of 1 byte, 9 to 16 bits = 2 bytes, etc...
Decimal
-10^38+1
10^38–1
Precision 1-9 = 5 bytes, precision 10-19 = 9 bytes, precision 20-28 = 13 bytes, precision 29-38 = 17 bytes
Numeric
no


Money
-2^63 / 10000
2^63-1 / 10000
8 bytes
Smallmoney
-214,748.3648
214,748.3647
4 bytes
Float
-1.79E + 308
1.79E + 308
4 bytes when precision is less than 25 and 8 bytes when precision is 25 through 53
Real
-3.40E + 38
3.40E + 38
4 bytes
Datetime
1753-01-01 00:00:00.000
9999-12-31 23:59:59.997
8 bytes
Date
0001-01-01
9999-12-31

Time
00:00:00.0000000
23:59:59.9999999

Char
0 chars
8000 chars
Defined width
Varchar
0 chars
8000 chars
2 bytes + number of chars
Text
0 chars
2,147,483,647 chars
4 bytes + number of chars
Nchar
0 chars
4000 chars
Defined width x 2
Nvarchar
0 chars
4000 chars

Ntext
0 chars
1,073,741,823 chars

Binary
0 bytes
8000 bytes

Varbinary
0 bytes
8000 bytes

Image
0 bytes
2,147,483,647 bytes


No comments:

Post a Comment