Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rounding decimal in sql server

Is it possible to round downward with SQL server 2008? E.g. .96855 is rounded to .968.

I.e. up to .96899 I want to round .96899 by avoiding rest.

like image 361
Nithesh Narayanan Avatar asked Mar 02 '11 12:03

Nithesh Narayanan


3 Answers

SELECT round(0.96855, 3, 1)

-> 0.96800

For 0.968 : cast(round(0.96855, 3, 1) as decimal(10,3)) works fine.

Ref: Round (if last param to Round is anything other than zero, it truncates)

like image 70
Xavinou Avatar answered Sep 20 '22 17:09

Xavinou


cast(round(0.96855, 3, 1) as decimal(10,3))

like image 35
Velu Avatar answered Sep 16 '22 17:09

Velu


Could this help?

SELECT ROUND(123.9994, 3)    
Results: 123.9990  


SELECT ROUND(123.9995, 3)    
Results: 124.0000   
like image 20
CloudyMarble Avatar answered Sep 16 '22 17:09

CloudyMarble