bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/SQL/SQL References
SQL•SQL References

SQL Server ROUND() Function

Concept visual

SQL Server ROUND() Function

Pointer walk
two pointers
leftright102132436485116
left=0
right=6
1
3

Start at both ends

Example

Round the number to 2 decimal places:

SELECT ROUND(235.415, 2) AS RoundValue;

Definition and Usage

The ROUND() function rounds a number to a specified number of decimal places.

Tip:

Also look at the FLOOR()

and

Ceiling()

functions.

Syntax

Round(

number, decimals, operation )

Parameter Values

Parameter

Description number

Required. The number to be rounded decimals Required. The number of decimal places to round number to operation Optional. If 0, it rounds the result to the number of decimal. If another value than 0, it truncates the result to the number of decimals.

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

Round the number to 2 decimal places, and also use the operation parameter:

SELECT ROUND(235.415, 2, 1) AS RoundValue;

Example

Formula

Round the number to - 1 decimal place:
SELECT ROUND(235.415, -1) AS RoundValue;

Previous

❮ SQL Server Functions

Next

Previous

SQL Server RAND() Function

Next

SQL Server SIGN() Function