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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Field Accuracy / Granularity

Author  Topic 

mikebird
Aged Yak Warrior

529 Posts

Posted - 2008-09-04 : 04:32:12
Not to change table design, but to fetch more decimal points back from a field in a query, if possible?

I want the accuracy of minutes elapsed in a 24-hour period, which could be anything from 1 minute to 23 hours, 50 minutes... When I get 25 minutes, I get the calculation result 24/1440 = 0 I need the result field to be much more accurate. Can I force that in the query?

Thanks

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-04 : 05:04:33
cast it to more accurate precision like decimal(20,5) or just do like below
24.0/1440 (multiply numerator by 1.0)
Go to Top of Page

mikebird
Aged Yak Warrior

529 Posts

Posted - 2008-09-04 : 05:19:45
Very helpful! Just putting 1440 as 1440.0 gives loads more accuracy!!

Thanks
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-04 : 05:23:26
quote:
Originally posted by mikebird

Very helpful! Just putting 1440 as 1440.0 gives loads more accuracy!!

Thanks


thats because of implicit conversion. adding .0 implicitly converts it to float type and so you will get decimal part also in result.
Go to Top of Page
   

- Advertisement -