Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

SQL: Only Rounded numbers shown, everything else: Useless

$
0
0

I'm currently having terrible Problems with SQL, I am trying to calculate certain values, similiar to the ex. below:

SELECT Sum(OrdersAchieved)/ Sum(SaleOpportunities) as CalculatedValue
FROM (
        SELECT Count(OT.SalesOpportunity) AS SaleOpportunities
               Count(VK.Orders) AS OrdersAchieved
        FROM fact_VertriebKalkulation VK
     ) AS A

Sadly every number that takes place in the calculation, is only shown as the last rounded number! say: 3/4 gives me 0, and 4/4 = 1, 8/4 = 2, and so on. While trying to find out what the Problem could be, i found that even the following seems to do the same Thing!

select 2/7 as Value

Gives Out = 0!!! so i tried this

select convert(float,2/7) as  Value

and it's the same Thing! What can i do, has anybody ever seen something like this? or does somebody know the Answer to my Question? Thanks a lot for your help in advance


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>