ROUND (TSQL Function)

Returns the first argument rounded to the specified number of digits.

Syntax

ROUND ( numeric_expression , num_digits [, truncate_flag] )

Arguments

numeric_expression
is a numeric expression of type int, bigint, money, numeric, float.
num_digits
is the number of digits to which you want to round numeric_expression. It is of type int.
If num_digits >= 0, numeric_expression is rounded to the number of decimal positions specified.
If num_digits < 0, rounding occurs on the left side of the decimal point.
truncate_flag
if omitted or 0, numeric_expression is rounded. Else, numeric_expression is truncated. It is of type int.

Return Types

Returns the same type as numeric_expression.

Examples

PRINT ROUND(748.58, 3), ROUND(748.58, 2), ROUND(748.58, 1), ROUND(748.58, 0);

The result is:

   748.58|   748.58|   748.60|   749.00|

With negative num_digits, rounding occurs on the left side of the decimal point:

PRINT ROUND(748.58, -1), ROUND(748.58, -2), ROUND(748.58, -3), ROUND(748.58, -4);

The result is:

   750.00|   700.00|  1000.00|     0.00|

With optional truncate_flag parameter != 0, the number is truncated:

PRINT ROUND(748.58, 3, 1), ROUND(748.58, 2, 1), ROUND(748.58, 1, 1), ROUND(748.58, 0, 1);

The result is:

   748.58|   748.58|   748.50|   748.00|