Saturday, February 25, 2012

round to nearest WHOLE number

T-SQL:
How to round to the nearest WHOLE number ?

so
from -- to
----
170 --170
96.58 --97

thanksHere are a couple of ways

SELECT ROUND(170,0)
SELECT ROUND(96.58,0)

SELECT CAST(170 AS DECIMAL(10,0))
SELECT CAST(96.58 AS DECIMAL(10,0))

No comments:

Post a Comment