ROUND (Transact‑SQL)

Overview

The ROUND function returns a numeric value rounded to the specified length or precision.

Syntax

ROUND ( numeric_expression , length [ ,function ] )

Parameters

ParameterDescription
numeric_expressionExpression of a numeric data type.
lengthPrecision to which to round. Positive values round to the right of the decimal point; negative values round to the left.
functionOptional. When 0 (default) or omitted, numeric_expression is rounded. When any other value is specified, numeric_expression is truncated.

Return Type

Returns the same data type as numeric_expression.

Remarks

Examples

Basic rounding

SELECT ROUND(123.4567, 2) AS RoundedValue;   -- 123.46

Rounding to the left of the decimal point

SELECT ROUND(123.4567, -2) AS RoundedValue;  -- 100.0000

Truncating instead of rounding

SELECT ROUND(123.4567, 2, 1) AS TruncatedValue;   -- 123.45

Interactive demo

See Also