圆形十进制截断小值 - 四舍五入

时间:2013-04-02 15:12:20

标签: sql-server types decimal number-formatting

例如,我有1000个西红柿,总共花费4.00美元。这将是每番茄0.004。我的数据类型是decimal (9,2)

如果我想将该值四舍五入到0.01,我将如何实现这一目标?

3 个答案:

答案 0 :(得分:0)

Select Round(CEILING(0.004 * 100)/100,2) 

答案 1 :(得分:0)

select  case 
        when cast(4.00/1000 as decimal(9,2)) < 0.01 then 0.01
        else cast(4.00/1000 as decimal(9,2))
        end

答案 2 :(得分:0)

这应该这样做:

select ceiling(0.004*100)/100