我在尝试以下使用SQL Server 2008 R2和SQL Server 2012,并且在两者中都得到相同的结果。在SQL Server中四舍五入的错误
如果我写如下语句:
select round(4.005, 2)
我得到预期的结果:4.01
但是,如果我写了下面的语句:
declare @result float
select @result = 4.005
select round(@result, 2)
我得到了意想不到的结果: 4
但是如果我替换float与真正在前面的语句:
declare @result real
select @result = 4.005
select round(@result, 2)
我得到预期的结果。
谁能告诉我为什么会发生这种情况?
现在有效,谢谢你的回应 – vcRobe 2013-02-25 19:27:21