Expand All
Collapse the table of content
Expand the table of content
Expand Minimize
The document is archived and information here might be outdated

ROUND (Transact-SQL)

Returns a numeric value, rounded to the specified length or precision.

Topic link icon Transact-SQL Syntax Conventions

ROUND ( numeric_expression , length [ ,function ] )


Is an expression of the exact numeric or approximate numeric data type category, except for the bit data type.


Is the precision to which numeric_expression is to be rounded. length must be an expression of type tinyint, smallint, or int. When length is a positive number, numeric_expression is rounded to the number of decimal positions specified by length. When length is a negative number, numeric_expression is rounded on the left side of the decimal point, as specified by length.


Is the type of operation to perform. function must be tinyint, smallint, or int. When function is omitted or has a value of 0 (default), numeric_expression is rounded. When a value other than 0 is specified, numeric_expression is truncated.

Returns the same type as numeric_expression.

ROUND always returns a value. If length is negative and larger than the number of digits before the decimal point, ROUND returns 0.

Example Result

ROUND(748.58, -4)


ROUND returns a rounded numeric_expression, regardless of data type, when length is a negative number.

Examples Result

ROUND(748.58, -1)


ROUND(748.58, -2)


ROUND(748.58, -3)


A. Using ROUND and estimates

The following example shows two expressions that demonstrate by using ROUND the last digit is always an estimate.

SELECT ROUND(123.9994, 3), ROUND(123.9995, 3)

Here is the result set.

----------- -----------
123.9990    124.0000    

B. Using ROUND and rounding approximations

The following example shows rounding and approximations.

SELECT ROUND(123.4545, 2);
SELECT ROUND(123.45, -2);GO

Here is the result set.



(1 row(s) affected)



(1 row(s) affected)

C. Using ROUND to truncate

The following example uses two SELECT statements to demonstrate the difference between rounding and truncation. The first statement rounds the result. The second statement truncates the result.

SELECT ROUND(150.75, 0);
SELECT ROUND(150.75, 0, 1);

Here is the result set.


(1 row(s) affected)


(1 row(s) affected)
© 2016 Microsoft