THE WORLD'S LARGEST WEB DEVELOPER SITE

SQL Server ROUND() Function

❮ SQL Server Functions

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 (starting with 2008), Azure SQL Database, Azure SQL Data Warehouse, Parallel Data Warehouse

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 »

❮ SQL Server Functions