July 12, 2006 at 5:50 am
When run following query I'm supposed to see "1" but I simply don't
select (3.0/23.0)+(4.0/23.0)+(7.0/23.0)+(9.0/23.0)
Also I tried to run the following but didn't work either
select
(cast (3 as decimal(30,28))/cast (23 as decimal(30,28))) +
(cast (4 as decimal(30,28))/cast (23 as decimal(30,28))) +
(cast (7 as decimal(30,28))/cast (23 as decimal(30,28))) +
(cast (9 as decimal(30,28))/cast (23 as decimal(30,28)))
Any suggestions?
Cheers
July 12, 2006 at 6:07 am
How about...?
select (cast (3 as float)/cast (23 as float)) +
(cast (4 as float)/cast (23 as float)) +
(cast (7 as float)/cast (23 as float)) +
(cast (9 as float)/cast (23 as float))
/*results
-----
1.0
*/
Here's a related thread - but not sure if it will help you:
http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=8&messageid=261586
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
July 12, 2006 at 6:25 am
Yes you are right and you are fast Thank you very much!
I was originally using money variables when the problem pop up first and thought the decimal should solve this. I must be fooled of overwork
Thanks again.
July 12, 2006 at 6:27 am
> I must be fooled of overwork
Aren't we all!
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply