Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL query - 'ROUND' COMMAND

Author  Topic 

annamaria
Starting Member

30 Posts

Posted - 2007-05-26 : 14:07:34
review

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-05-26 : 14:15:52
post some sample data to help us understand what you're asking.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

PSamsig
Constraint Violating Yak Guru

384 Posts

Posted - 2007-05-27 : 05:24:31
I think your server is doing a swell job, it must be your calculator who needs a checkup:

4,866 /360 * 30 = 0,4055 ~ 0,406

if you don't belive me, then do it in integers:

48660 * 300000 / 3600000 = 4055

-- If you give someone a program, you will frustrate them for a day; if you teach them how to program, you will frustrate them for a lifetime.
Go to Top of Page

pbguy
Constraint Violating Yak Guru

319 Posts

Posted - 2007-05-27 : 23:58:20
try like this

select round(round(4866.0 / 360.0 * 30.0, 2),0)
Go to Top of Page

Jeff Moden
Aged Yak Warrior

652 Posts

Posted - 2007-05-28 : 00:15:09
>>it doesn't round 0,4055 but 0,4054999998.

That's because you are using the FLOAT data type. You must either compensate for using it or use another datatype like maybe DECIMAL with the appropriate scale and precision.


--Jeff Moden
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-05-28 : 11:12:31
because float isn't a exact type. it hold approximates.
look in books online for better understanding.


_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page
   

- Advertisement -