Data
Type Description Storage
Space
Char(n)
N between 1 and 8,000
characters n
bytes
Nchar(n)
N between 1 and 4,000
Unicode characters (2
x n bytes) + 2 bytes overhead
Ntext
Up to ((2 to the
30th power) - 1)
(1,073,741,823)
Unicode characters
2
bytes per character stored
Nvarchar(max)
Up to ((2 to the 30th power) - 1)
(1,073,741,823)
Unicode characters
2
x characters stored + 2 bytes
Text
Up to ((2 to the
31st power) - 1)
(2,147,483,647)
characters
1
byte per character stored
Varchar(n)
N between 1
and 8,000 characters 1
byte per character stored + 2
bytes
overhead
Varchar(max)
Up to ((2 to the 31st power) -
1)
(2,147,483,647)
characters
1
byte per character stored + 2
bit
0, 1, or Null 1
byte for each 8 columns of this
tinyint
Whole numbers from 0
to 255 1
bytes
smallint
Whole numbers from
–32,768 to 32,767 2
bytes
int
Whole numbers
from –2,147,483,648 to 4
bytes
2,147,483,647
bigint
Whole numbers from –9,223,372,036,854,775,808
to
9,223,372,036,854,775,807
8
bytes
numeric(p,s)
or
decimal(p,s)
Numbers from –1,038 +1 through
1,038 –1 Up to
17 bytes
money –922,337,203,685,477.5808
to 922,337,203,685,477.5807 8 bytes
smallmoney –214,748.3648 to 214,748.3647 4
bytes
float[(n)]
−1.79E+308 to
-2.23E-308,0, 2.23E-308 to 1.79E+308 N<
= 24 - 4 bytes
N>
24 - 8 bytes
real()
−3.40E+38 to
-1.18E-38,0, 1.18E-38 to 3.40E+38 4
bytes
Binary(n)
N between 1 and 8,000 hex
digits n bytes
Image
Up to
231-1(2,147,483,647) hex digits 1
byte per character
Varbinary(n)
N between 1 and 8,000 hex
digits 1 byte
per character stored + 2 bytes overhead
Varbinary(max)
Up to 231-1(2,147,483,647)
characters 1 byte per
character stored + 2
Date
January 1, 1 to
December 31, 9999 3
bytes
Datetime January 1, 1753 to December
31, 9999 8 bytes
Datetime2(n)
January 1, 1 to December 31,
9999 6 to 8 bytes
Datetimeoffset(n)
January 1, 1 to December 31, 9999 8 to 10 bytes
SmalldateTime
January 1, 1900 to June 6, 2079, 4
bytes
Time(n)
Hours:minutes:seconds.9999999 3
to 5 bytes
N between 0
and 7 specifies fractional seconds
No comments:
Post a Comment