Round *UP* to the nearest 100 in SQL Server

后端 未结 13 958
野性不改
野性不改 2020-12-25 11:18

Is it possible to easily round a figure up to the nearest 100 (or 1000, 500, 200 etc.) in SQL Server?

So:

720 -> 800
790 -> 800
1401 -> 1500

13条回答
  •  無奈伤痛
    2020-12-25 11:38

    It is very simple to round a number to any multiple of nearest 10 by using simply the ROUND function for ex:

    SELECT ROUND(number/1000,2)*1000 
    

    This will give you the nearest thousandth value.

提交回复
热议问题