round

Returns the value of the specified number, rounded to the specified number of decimal places.

Syntax

round(number, decimal_places)

Parameters

Examples

Usage

  • round, a mathematical function, rounds the number so that it has decimal_places significant digits.

  • A positive value for decimal_places determines the number of significant digits to the right of the decimal point; a negative value for decimal_places determines the number of significant digits to the left of the decimal point.

  • Results are of the same type as number and, for numeric and decimal expressions, have an internal precision equal to the precision of the first argument plus 1 and a scale equal to that of number.

  • round always returns a value. If decimal_places is negative and exceeds the number of significant digits specified for number, the SAP ASE server returns 0. (This is expressed in the form 0.00, where the number of zeros to the right of the decimal point is equal to the scale of numeric.) For example, the following returns a value of 0.00:
    select round(55.55, -3)

See also Transact-SQL Users Guide.

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

Any user can execute round.

Related reference
abs
ceiling
floor
sign
str