ROUND in SQL query
Posted on 1998-08-31
In a SQL query, I use the ROUND function to round a double type field with n decimals. The problem is that it rounds to the closiest even number, and I'd like to round to the closiest integer !
For example : ROUND(1.5 , 0) ==> 2
ROUND(2.5 , 0) ==> 2
I want : MyFunction(1.5, 0) ==> 2
MyFunction(2.5, 0) ==> 3
Same thing with n decimals
(I have a solution in ACCESS but not in SQL-SERVER and ORACLE: under ACCESS it is like that :
...SET amount = fix(amount*rate*10^NbDecimals+0.5)/10^NbDecimals
Thank you for help.