sqlserver
作者:互联网
基本数据类型
- 整形数据:
bigint | 8 byte |
int | 4 byte |
smallint | 2 byte |
tinyint | 1 byte |
C#定义的整形数据
long | 8 byte |
ulong | 8 byte |
int | 4 byte |
uint | 4 byte |
short | 2 byte |
ushort | 2 byte |
sbyte | 1 byte |
byte | 1 byte |
是能一一对应上的。
- 浮点类型:
| | |
| ------------ | ------------ |
| real | |
| | |
float [ (n) ] Where n is the number of bits that are used to store the mantissa of the float number in scientific notation and, therefore, dictates the precision and storage size. If n is specified, it must be a value between 1 and 53. The default value of n is 53.
mantissa n.对数
notation n.符号
type | n | |
---|---|---|
float/real | 1~24 | 4 byte |
float | 24~53 | 8 byte |
可以发现与C#中的浮点类一样。因为两者都是符合ISO规范的。
- 精确计数
decimal[(p[,s])]
numeric[(p[,s])]
p (precision)
The maximum total number of decimal digits to be stored. This number includes both the left and the right sides of the decimal point. The precision must be a value from 1 through the maximum precision of 38. The default precision is 18.
p是指数字位数,包括整数和小数。值域为[1,38]。默认为18。
s (scale)
The number of decimal digits that are stored to the right of the decimal point. This number is subtracted from p to determine the maximum number of digits to the left of the decimal point. Scale must be a value from 0 through p, and can only be specified if precision is specified. The default scale is 0 and so 0 <= s <= p. Maximum storage sizes vary, based on the precision.
s是指整数位数,值域[0,p],可以不指定。
Precision | Storage bytes |
---|---|
1 - 9 | 5 |
10-19 | 9 |
20-28 | 13 |
29-38 | 17 |
- 货币计算
smallmoney | 8 byte |
money | 4 byte |
储存时不会储存货币符号,只会储存数值。
标签:decimal,float,sqlserver,number,value,precision,byte 来源: https://www.cnblogs.com/none323/p/15190170.html