ahhh I think this has more to do with implicit casting
if you do the following
declare @res decimal(9,5)
set @res = (61.0 * 4.0 * 31.0)/36500.0
print @res
then you'll get the right result. i'm presuming that sql server evaluates the brackets first and then hold that as an int then does the division. as the value is an int the bits after the decimal point are lost
I believe it is the presence or absence of decimals. Calculations against integers return integers, calculations against decimals return decimals. In tapks' example, all values are integers, so the solution resolves to an integer, zero. Both of SteveBrett's example use decimals, so his results are decimals.
--John
-----------------------------------
Behold! As a wild ass in the desert
go forth I to do my work.
--Gurnie Hallock (Dune)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.