日期:2014-05-19  浏览次数:20807 次

sqlserver 2005 四舍五入的bug?
round函数。。

select   round(0.6)

select   round(9.6)

报错!!

An   error   occurred   while   executing   batch.   Error   message   is:   Arithmetic   Overflow.


大虾们又没有碰到过?

难道是2005的bug?

好像2000不会报错。。

------解决方案--------------------
试过了,确实如此
在2005的managementstudio中连接2000和2005进行查询,结果一样,都出错
应该是bug吧

在2000的查询分析器中连接2000和2005进行查询,结果一样,都不出错
------解决方案--------------------
我在数据库执行select round(9.6,0),报了一个好像是溢出的错误,不可以这样写么?

------解决方案--------------------
看了一下,在SQL2000里面没事(我的是打了补丁sp4),在2005中不行(打了补丁sp2)!
------解决方案--------------------
应该处在 length 的问题.

numeric_expression 的舍入精度。length 必须是 tinyint、smallint 或 int。如果 length 为正数,则将 numeric_expression 舍入到 length 指定的小数位数。如果 length 为负数,则将 numeric_expression 小数点左边部分舍入到 length 指定的长度。


length可能不能为0.
------解决方案--------------------
应该是2005的bug!
------解决方案--------------------
sql management 的bug...因为查询分析器可以用...