Returns a numeric expression, rounded to the specified length or precision.

ROUND ( numeric_expression, length [ , function ] )

Arguments

  • numeric_expression
    An expression of the exact numeric or approximate numeric data type categories, or types that are implicitly convertible to float.

  • length
    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.

  • function
    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

tinyint, smallint

int

real/float

float

Nonnumeric types that can be implicitly converted to float

float

Example

The following example returns the unit price, rounded to the nearest dollar, of products listed in the Productstable.

SELECT [Unit Price], ROUND([Unit Price], 0)
FROM Products