Thursday, March 22, 2012

3086/3600 = 0.0 .... WHY Should be 0.857

I have a float field in a table ... when I try and add the result of the following division ... 3086/3600 ... to that field it displays as 0.0.

Can anyone explain why?

Does anyone know how to get around this and get 0.857 into that field instead.

I have tried changing the data type to Decimal(20,2) but this has had no effect.

Any suggestions would be very much appreciated.Solved it ... just do

3086 / CAST(3600 AS FLOAT)

and case solved :)|||Hi , Try this

select 3086/3600.00

will give u the desired result...

Cheers
Gola Munjal
Originally posted by briansy
I have a float field in a table ... when I try and add the result of the following division ... 3086/3600 ... to that field it displays as 0.0.

Can anyone explain why?

Does anyone know how to get around this and get 0.857 into that field instead.

I have tried changing the data type to Decimal(20,2) but this has had no effect.

Any suggestions would be very much appreciated.

No comments:

Post a Comment