SQL SERVER的四舍五入

select round(avg(Delay),2) from Attachdelaytime where inserttime>'2013-02-06 00:00:00.000' and inser


这样报错.

因为DELAY是整型.

ROUND使用之要做类型转换.

select ROUND(AVG(CAST(delay as float)),2)
from Attachdelaytime where inserttime>'2013-02-06 00:00:00.000' and inserttime<'2013-03-31 23:59:59.999'


这样就对了.比ORACLE要多一步类型转换.

猜你喜欢

转载自xixiyanqi.iteye.com/blog/1917968