Skip to main content

ROUND() Function

Definition The ROUND() function returns a numeric value, rounded to the specified length or precision.   Syntax ROUND(numeric_expression , length, [function]) where  numeric_expression is an expressio

Updated over 2 weeks ago

Definition

The ROUND() function returns a numeric value, rounded to the specified length or precision.

Syntax

ROUND(numeric_expression , length, [function])

where

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

length 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.

function 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.

Example(s)

1. Using the ROUND function to round the numeric_expression to a three decimal places.

What to use in Custom SQL field:

  • ROUND(123.9994, 3)

  • ROUND(123.9995, 3)

Field Outputs:

mceclip0.png

2. Using the ROUND function to round the numeric_expression to 2 places one to the right of the decimal point (positive length) and the other to the left of the decimal point (by using a negative length).

What to use in Custom SQL field:

  • ROUND(123.4545, 2)

  • ROUND(123.4545, -2)

Field Outputs:

mceclip3.png

Did this answer your question?