how to round the percentage?


how to round the percentage?


I am populating percentage calculation value to a decimal(5,2) field.

I tried to cast the computed value to decimal(5,2), but unable to get the desired result.

For example :

select cast((1/293)*100 as decimal(5,2))
Result : 0.00

Result I am expecting is: 0.34

Any suggestions

Thanks in advance.

Re: how to round the percentage?

Its because you are performing integer division and then casting it.
Eg: sel 1/4 will also return you 0. and further casting it will not help.

what you can try is :
select cast( 1/293.0000 * 100 as decimal(5,2))