SQL Server ROUND() Function
Example
Returns a number rounded to a certain number of decimal places:
SELECT ROUND(235.415, 2) AS RoundValue;
Try it Yourself »
Definition and Usage
The ROUND() function returns a number rounded to a certain number of decimal places.
Tip: See also the FLOOR() and CEILING() functions.
Syntax
ROUND(number, decimal_places, operation)
Parameter Values
Parameter | Description |
---|---|
number | Required. The number to round |
decimal_places | Required. The number of decimal places to round to |
operation | Optional. Can be either 0 or any other numeric value. When 0, ROUND() will round the result to the number of decimal_places. When another value than 0, ROUND() will truncate the result to the number of decimal_places. Default value is 0 |
Technical Details
Works in: | SQL Server 2014, SQL Server 2012, SQL Server 2008 R2, SQL Server 2008, SQL Server 2005 |
---|
More Examples
Example
Returns a number rounded to a certain number of decimal places:
SELECT ROUND(235.415, 2, 1) AS RoundValue;
Try it Yourself »
Example
Returns a number rounded to a certain number of decimal places:
SELECT ROUND(235.415, -1) AS RoundValue;
Try it Yourself »