Returns a numeric expression, rounded to the specified length or precision.
ROUND ( numeric_expression , length [ , function ] )
- Is an expression of the exact numeric or approximate numeric data type categories, or types that are implicitly convertible to float.
- Is the precision to which numeric_expression is to be rounded. When length is a positive number, numeric_expression is rounded to the number of decimal places specified by length. When length is a negative number, numeric_expression is rounded on the left side of the decimal point, as specified by length.
- Is the type of operation to perform. When function is omitted or has a value of 0 (default), numeric_expression is rounded. When a value other than 0 is specified, numeric_expression is truncated.
Returns the same type as numeric_expression except for the following expressions.
|Specified expression||Return type|
|Nonnumeric types that can be implicitly converted to float||float|
The following example returns the unit price, rounded to the nearest dollar, of products listed in the Products table of the Northwind database.
SELECT UnitPrice, ROUND(UnitPrice, 0) FROM Products