ROUND
Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API
Rounds a value to the nearest integer or to a specified number of decimal places.
Syntax
1round(<dp_or_numeric>)
2round(<v> dp_or_numeric, <s> int)
Arguments
Required
<dp_or_numeric> / <v>: The double precision or numeric value to round.
Optional
<s>: The number of decimal places to round to. When omitted, the value is rounded to the nearest integer.
Returns
Returns the rounded value by using the same data type as the input.
Considerations
- Rounding behavior on ties (values exactly halfway between two integers) is unspecified.
- A negative value for
s rounds to the left of the decimal point.
- Non-finite floating-point values (
Infinity, NaN) are returned unchanged.
Examples
Round to the Nearest Integer
Round a value with no decimal places specified.
1SELECT round(42.4) AS result;
Returns 42.
Round to Decimal Places
Round a value to two decimal places.
1SELECT round(42.4382, 2) AS result;
Returns 42.44.
Round to the Left of the Decimal Point
Use a negative number of decimal places to round to tens, hundreds, and so on.
1SELECT round(1234.56, -2) AS result;
Returns 1200.
Related Documentation