Click here to Skip to main content
15,891,943 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
select Round((10*100)/115,0)

Result : 8

But Result : 8.69

But i want to display 9

I tried below query also, but result is same..

select Round((10*100)/115,0)

Please solve my prob....

Thanks
Posted
Updated 14-Dec-14 19:03pm

Check this Query
SQL
select   Round((10*100)/115,0),
		(CAST(10*100 AS decimal(10,2))/115),
		 ROUND(CAST(10*100 AS decimal(10,2))/115,0),
		 FLOOR(CAST(10*100 AS decimal(10,2))/115),
		 CEILING(CAST(10*100 AS decimal(10,2))/115)
 
Share this answer
 
Comments
Member 9409254 15-Dec-14 2:18am    
Hi Shanu,
select (CAST(10*100 AS decimal(10,2))/115)
When i execute this i am getting my required result.
= 8.700000
But i want to display only 8.7
what modification i can do to get it resolved ?
Thanks
Member 9409254 15-Dec-14 2:19am    
I used this Query

select Round((CAST(10*100 AS decimal(10,0))/115),1)

Result : 8.700000

But Display 8.7
syed shanu 15-Dec-14 2:23am    
Try this :
Kindly study and understand the functionality so that you can do by your own.

select Cast(Round((CAST(10*100 AS decimal(10,0))/115),1) as decimal(10,1))

Before asking question kindly try by yourself for >if you find hard then ask question.
Member 9409254 15-Dec-14 2:58am    
Thanks Shanu
Got required result

Thanks Soomuch
select Round((10*100)/115,0) as numeric(36,2)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900