zoukankan      html  css  js  c++  java
  • Microsoft SQL Server 中的小数数据类型

    From MSDN:

    float and real

    Approximate number data types for use with floating point numeric data. Floating point data is approximate; not all values in the data type range can be precisely represented.

    Syntax

    float [ ( n ) ]

    Is a floating point number data with the following valid values: - 1.79E + 308 through -2.23E - 308, 0 and 2.23E -308 through 1.79E + 308. n is the number of bits used to store the mantissa of the float number in scientific notation and thus dictates the precision and storage size. n must be a value from 1 through 53. The default value of n is 53.

    n is Precision Storage size
    1-24 7 digits 4 bytes
    25-53 15 digits 8 bytes

    The Microsoft® SQL Server™ float[(n)] data type conforms to the SQL-92 standard for all values of n from 1 to 53. The synonym for double precision is float(53).

    real

    Is a floating point number data with the following valid values: –3.40E + 38 through -1.18E - 38, 0 and 1.18E - 38 through 3.40E + 38. Storage size is 4 bytes. In SQL Server, the synonym for real is float(24).

    Note  Microsoft® SQL Server™ 2000 treats n as one of two possible values. If 1<=n<=24,  n is treated as 24. If 25<=n<=53, n is treated as 53.

    decimal and numeric (Transact-SQL)

    Numeric data types that have fixed precision and scale.

    decimal[ (p[ , s] )] and numeric[ (p[ , s] )]

    Fixed precision and scale numbers. When maximum precision is used, valid values are from - 10^38 +1 through 10^38 - 1. The ISO synonyms for decimal are dec and dec(p, s). numeric is functionally equivalent to decimal.

    p (precision)

    The maximum total number of decimal digits that can be stored, both to the left and to the right of the decimal point. The precision must be a value from 1 through the maximum precision of 38. The default precision is 18.

    s (scale)

    The maximum number of decimal digits that can be stored to the right of the decimal point. Scale must be a value from 0 through p. Scale can be specified only if precision is specified. The default scale is 0; therefore, 0 <= s <= p. Maximum storage sizes vary, based on the precision.

    Precision Storage bytes

    1 - 9

    5

    10-19

    9

    20-28

    13

    29-38

    17

    money and smallmoney (Transact-SQL)

    Data types that represent monetary or currency values.

    Data type Range Storage

    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

  • 相关阅读:
    vxlan 内核实现
    perf 系统调用
    quic NAT
    机器学习在ABR算法中的应用纵览
    清华最新AIOps案例:强化学习,降低网络传输延时
    内核gso
    怎么提高网络应用性能?让DPDK GRO和GSO来帮你!
    网卡VXLAN的offload技术介绍
    Matplotlib中的plt和ax画图的区别
    Task 3: 异常处理(2天)
  • 原文地址:https://www.cnblogs.com/simonhaninmelbourne/p/1401941.html
Copyright © 2011-2022 走看看