Monday, March 12, 2012

manipulation with numbers in SQL

Hi folks,

I am trying to divide a number by another number.. for example,

'-5037542 / 143149696'

The answer should be -0.03519.

Inspite of using round,convert and numeric functions i am unable to get the answer as above. It calculates wrongly..

I would appreciate if anyone could help.

TIA,
Nishaint / int = int, convert either number to a float and you will get your answer
select -5037542 / cast(143149696 as float) as 'Ans'

Ans
----------------
-0.0351907278936869|||Thanks a lot Paul Young!!!

-Nisha

No comments:

Post a Comment