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
Query:
select CEILING(21.8) as FirstRounupvalue

Result:22
In the above image i just give an example to round  three number in one statement.you 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.
Query:
select FLOOR(21.8) as AfterFloorNumber

Result:21


No comments:

Bel