Money Data Type Precision - SQL Server (SSMS)

北慕城南 提交于 2019-12-06 11:55:31

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
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!