Money数据类型精度-SQL Server(SSMS) [英] Money Data Type Precision - SQL Server (SSMS)

查看:220
本文介绍了Money数据类型精度-SQL Server(SSMS)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在sql server management studio中,数据类型为money,当我输入带小数的金额时,它会自动加零以填满百分之一。如何确定小数点后的空格数量?

In sql 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?

推荐答案

点后面的零位数称为<$ c数据类型的$ c>精度。 money 数据类型具有固定精度

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))

此打印:

0.1235    0.123    0.1

这篇关于Money数据类型精度-SQL Server(SSMS)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆