ROUND in SQL query

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.
gosselinAsked:
Who is Participating?
 
thresholdConnect With a Mentor Commented:
Ok, Thanks.... I repost my 'note' again.

In my SQL Server 6.5, i got
ROUND(2.5 , 0) ==> 3
0
 
thresholdCommented:
In my SQL Server 6.5, i got

ROUND(2.5 , 0) ==> 3
0
 
gosselinAuthor Commented:
Your are rigth. This result is obtain with the CLng function of ACCESS, I was completly wrong. So there is no question any more.

Thank you very much
How can I give you the points ?

0
 
thresholdCommented:
You r welcomed.
Keep it...
Delete the question...
0
 
altenaCommented:
You really deserve the points treshold.

Its the little things like this that can really
eat one's time away. And with hindsight it is
oh so simple :-)

---Cheers
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.