Money Data Type Precision - SQL Server (SSMS)
In sql 开发者_Go百科server management studio, data type- money, when I enter an amount with a decimal it automatically adds on zeros to fill up to the hundredths. How can I determine the amount of spaces after the decimal?
The number of zeroes behind the dot is called the precision of a datatype. The money data type has a fixed precision:
with accuracy to a ten-thousandth of a monetary unit.
That's five digits behind the dot. If you'd like a different precision, use the decimal datatype. Some examples:
select cast(0.123456789 as money)
, cast(0.123456789 as decimal(5,3))
, cast(0.123456789 as decimal(5,1))
This prints:
0.1235 0.123 0.1
加载中,请稍侯......
精彩评论