ROUND (Transact-SQL)
The ROUND function returns a numeric value, rounded to the specified length or precision.
Syntax
ROUND ( numeric_expression , length [ ,function ] )
| Parameter | Description |
|---|---|
numeric_expression | Expression of type numeric, decimal, float or real. |
length | Precision to which numeric_expression is rounded. Positive values round to the right of the decimal point; negative values round to the left. |
function | Optional. If 0 (default) or omitted, the function rounds. If any other value, the function truncates. |
Return Types
The return type is the same as the input numeric_expression (except for float and real, which return float).
Examples
SELECT ROUND(123.4567, 2) -- Returns 123.46
SELECT ROUND(123.4567, -2) -- Returns 100.00
SELECT ROUND(123.4567, 0, 1) -- Returns 123 (truncated)