March 30, 2010 at 6:46 am
Hello,
I have some strange messages. After
SELECT ROUND(.7545, 0)
I received: An error occurred while executing batch. Error message is: Przepełnienie arytmetyczne.
Select round(28/31, 0) gives 0 as result. (In my opinion 1 is correct)
Select round(28/31, 0) gives 1 as result. (In my opinion 2 is correct)
Do you know how to solve these problems. Thanks in advance
Jacek
March 30, 2010 at 6:50 am
Go through the below link where a similar issue was discussed
http://www.sqlservercentral.com/Forums/Topic890414-338-1.aspx
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
March 31, 2010 at 5:03 am
Thank you for quick reply. I hven't any error messages now. But
Select round(cast(29/31 AS DECIMAL(10,4)), 0)
is still
0
not 1!!
Please help me
Jacek
March 31, 2010 at 5:35 am
Can you uses thia code
Select round(1.0*29/31,0)
When 29/31, SQL will use DIV (29 DIV 31) if both number are INTEGER. If you multiple 1.0 before 29, you can resolve your problem
March 31, 2010 at 7:07 am
Yes. It's really works.
Thanks a lot for your help
Jacek
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply