Answers for "Calculate to show exact result neither rounded up or down"
https://ask.sqlservercentral.com/questions/118754/calculate-to-show-exact-result-neither-rounded-up.html
The latest answers for the question "Calculate to show exact result neither rounded up or down"Answer by jonlellelid
https://ask.sqlservercentral.com/answers/119167/view.html
Aha! Thanks Grant for the decimal hint. I got the formula to show 65.8 for example.
I had DECLARE @nNumberOfHolds decimal (5,1) ;
In the table variable, I set the output column to decimal:
Order_More_Copies decimal (5,1) NULL
Then used this formula:
SET Order_More_Copies =(ROUND(t.HoldCount, 5,1)/@nNumberOfHolds) - t.ItemCountWed, 25 Mar 2015 14:34:27 GMTjonlellelidAnswer by jonlellelid
https://ask.sqlservercentral.com/answers/119130/view.html
I set the variable to decimal and used cast in the calculation and still get an integer. Would also consider rounding the number up. How would I do that? [link text][1]
[1]: /storage/temp/2269-set-statement-and-calculation.txtTue, 24 Mar 2015 17:47:23 GMTjonlellelidAnswer by Mister Magoo
https://ask.sqlservercentral.com/answers/118756/view.html
I'm betting that @nNumberOfHolds is an integer? Which will cause the division operation to produce an integer result. Try changing that variable to a decimal type, or cast it as a decimal in the calculation.Sat, 14 Mar 2015 00:23:54 GMTMister Magoo