美文网首页
Understanding decimal(p, s) of s

Understanding decimal(p, s) of s

作者: 吉他小文 | 来源:发表于2016-05-02 19:41 被阅读0次

    带固定精度和小数位数的数值数据类型。
    decimal(p[ ,s]) 和 numeric(p[ ,s])

    固定精度和小数位数。 使用最大精度时,有效值的范围为 - 10^38 +1 到 10^38 - 1。 decimal 的 ISO 同义词为 dec 和 dec(p、s)。 numeric 在功能上等价于 decimal。

    p(精度)
    最多可以存储的十进制数字的总位数,包括小数点左边和右边的位数(does not include decimal point)。 该精度必须是从 1 到最大精度 38 之间的值。 默认精度为 18。

    s (小数位数)
    小数点右边可以存储的十进制数字的最大位数。 小数位数必须是从 0 到 p 之间的值。 仅在指定精度后才可以指定小数位数。 默认的小数位数为 0;因此,0 <= s <= p。 最大存储大小基于精度而变化。

    SQL Server 会将精度和小数位数的每个特定组合视为不同的数据类型。

    相关文章

      网友评论

          本文标题:Understanding decimal(p, s) of s

          本文链接:https://www.haomeiwen.com/subject/huylrttx.html