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
 Transact-SQL (2000)
 Incorrect Calculation

Author  Topic 

bridge
Yak Posting Veteran

93 Posts

Posted - 2005-06-20 : 03:02:46
I am calculating Yield as

select (20/822)*100 in Query Analyzer but it returns 0. While the same formula in Excel return 2.433090024. Please help me int getting the correct value?

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-06-20 : 03:10:01
You need to use decimal values
select (20.0/822.0)*100.0


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

bridge
Yak Posting Veteran

93 Posts

Posted - 2005-06-20 : 03:11:56
But if a query is returning integer values and I am using this calculation on two integer columns, then what I'll have to do
Go to Top of Page

bridge
Yak Posting Veteran

93 Posts

Posted - 2005-06-20 : 03:13:32
Thanks

I just did it by casting the columns to decimal
Go to Top of Page
   

- Advertisement -