(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
         

解决方案 »

  1.   

    msdn? 应该是sql吧   不过上面的就是sql里面的原话 但是我想知道的是如何通过精度计算出后面的字节数?请楼上详细点
      

  2.   

    带固定精度和小数位数的数值数据类型。 decimal[ (p[ , s] )] 和 numeric[ (p[ , s] )] 固定精度和小数位数。使用最大精度时,有效值从 - 10^38 +1 到 10^38 - 1。decimal 的 SQL-92 同义词为 dec 和 dec(p, s)。numeric 在功能上等价于 decimal。p(精度) 最多可以存储的十进制数字的总位数,包括小数点左边和右边的位数。该精度必须是从 1 到最大精度 38 之间的值。默认精度为 18。s(小数位数) 小数点右边可以存储的十进制数字的最大位数。小数位数必须是从 0 到 p 之间的值。仅在指定精度后才可以指定小数位数。默认的小数位数为 0;因此,0 <= s <= p。最大存储大小基于精度而变化。
       精度        字节数 Storage bytes    1 - 9        5    10-19        9    20-28        13    29-38          17