Monday, June 4, 2012

how to round a number in sql server

Here i will  give a simple query to round  the number in sql.For this we have a sql function  ROUND() is used to convert to near number if the number is decimal number
select CEILING(21.8) as FirstRounupvalue

In the above image i just give an example to round  three number in one can see the output as in below columns in results.The ceiling is convert the decimal number to nearest maximum number.If you want round to number minmum number ,we have to use FLOOR.
select FLOOR(21.8) as AfterFloorNumber


No comments: