I have a calculated field 'MySum' in inner query whose value after calculation is 58.
I need to get 20% of this value.
If I give:
MySum * 20 /100, I get 11
If I give:
((20 * CAST(MySum as decimal(6,2)))/100) , I get 11.60000
If I give
Round(((20 * CAST(MySum as decimal(6,2)))/100), 2), I still get 11.60000
I want that,
If result comes 11.6, it should display 12 and if result is 11.4, it should display 11.
I want to Rounded off values. Any function for that ?
use ROUND () (See examples ) function in sql server
select round(11.6,0)
result:
12.0
ex2:
select round(11.4,0)
result:
11.0
if you don't want the decimal part, you could do
select cast(round(11.6,0) as int)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With