Range of -2 31 is to 2 31 is -1, i.e., 2,147,483,648 - 2,147,483,647
bigint
8 bytes
Range of -2 63 is to 2 63 is -1
decimal(p,s)
And related precision
p represents the number of decimal places and the left and right, s represents the number of digits to the right of the decimal point, p ranges from 1 to 38, default is 18. S ranges from 0 to p, the default is 0
numeric(p,s)
And related precision
p represents the number of decimal places and the left and right, s represents the number of digits to the right of the decimal point, p ranges from 1 to 38, default is 18. S ranges from 0 to p, the default is 0
smallmoney
4 bytes
Maximum 214748.3647
money
8 bytes
922,337,203,685,477.5808 maximum value, this value is actually 2 63 is -1 to move the decimal point to give
Approximation type
type of data
Use storage
Explanation
float(n)
Depending on n
n is the number of bits of the mantissa values stored float, n ranges from 1 to 53, the default value is 53. SQL Server, if n is between 1 and 24, n regarded as 24, n 25 to 53, 53 n regarded. When the value of n is 24, 4 bytes. The value of n is 53, 8 bytes. Range divided into three sections,−1.79×10. 3 0 . 8 to−2.23×10−308,0,2.23×10- . 3 0 . 8 to. 1.. 7. 9×10308
real
4 bytes
Range divided into three sections,−3.40×103 8 to−1.18×10−38,0,1.18×10- . 3 . 8 to. 3.. 40×1038
Text Types
Ordinary character encoding
Each English character occupies one byte, two bytes for each character
type of data
Use storage
Explanation
char(n)
n bytes
Fixed length, n ranges from 1 to 8000
varchar(n)
Data storage and related storage of an English characters occupy one byte
Variable length, n represents the maximum length of the string stored, n ranges from 1 to 8000
text
And storing data related to store a two-byte characters representing
Variable-length string maximum length of 2 31 is -1 bytes
Unicode character encoding
Each character in English and Chinese characters are two bytes
type of data
Use storage
Explanation
nchar(n)
n bytes
Fixed length, n ranges from 1 to 4000
nvarchar(n)
Data storage and related storage of an English characters occupy two bytes
Variable length, n represents the maximum length of the string stored, n ranges from 1 to 4000
ntext
And storing data related to store a two-byte characters representing
Variable-length string maximum length of 2 30 -1 or kanji characters
Date Time Type
type of data
Use storage
Explanation
data
3 byte
Range 0001/01/01 to 9999/12/31
time
5 bytes
Range 00:00: 00.0000000 to 23: 59: 59.9999999
datetime
8 bytes
1753/01/01/00 range: 00:00 to 9999/12/31/23: 59: 59: 997
smalldate
4 bytes
1900/01/01/00 range: 00:00 to 2079/06/06/23: 59: 59
Binary type
type of data
Use storage
Explanation
binary(n)
n bytes
Fixed-length binary data, n ranges from 1 to 8000
varbinary(n)
And related data stored
Variable-length binary data, n represents the maximum storage bytes, n ranges from 1 to 8000