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

CASE is rounding up to full number

$
0
0

Hi

I have a problem with a case function that I hope someone can help me with.

I have the following code:

CASE WHEN S.SumOfSchedule_Qty > 0 THEN (S.SumOfSchedule_Qty - 1) / S.Pallet_Qty)

ELSE 0

END AS DecNoOfPallets

The problem with it is that is for example SumOfSchedule_Qty = 20 and Pallet_Qty is 3 it gives me the answer as 7 whereas I want it to come out as 6.66666666

I tried convert(decimal(18,8) but this made the calculation first round it up and then did the convert.

Any ideas?

Aaron


Viewing all articles
Browse latest Browse all 23857

Trending Articles



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