Syntax of ROUND Function :
ROUND ( numeric_expression , length [ ,function ] )
numeric_expression is a number or approximate number data type except bit.
length is the precision. It can be of type int, smallint or tinyint. If it is positive then decimal part of a number is rounded and if it is negative then number is rounded on the left side of the decimal point.
function specifies the type of operation to perform. It can be of data type int, smallint or tinyint. If you dont specify value for function or specify value 0 then the numeric_expression is rounded and when you specify value other then 0 then it is truncated.
Return type of SQUARE function is same as specified numeric expression.
Examples of ROUND Function :
Example 1 : Use of ROUND function in select clause
SELECT ROUND(123.576,2), ROUND(123.123,2)
Output
123.580 123.120
Above example returns rounded values in decimal part of specified number by 2 digits.
Example 2 : Use of ROUND function in select clause
SELECT ROUND(567.655,-2), ROUND(512.566,-2)
Output
Above example rounded values on the left side of decimal point of the specified number by 2 digits.
Example 3 : Use of ROUND function to get rounded and truncated values in select clause
SELECT ROUND(560.80,0), ROUND(560.80,0,1)
Output
In above example 1st value is rounded annd 2nd value is truncated.