round

Description

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

Syntax

round(number, decimal_places)

Parameters

number

is any exact numeric (numeric, dec, decimal, tinyint, smallint, int, or bigint), approximate numeric (float, real, or double precision), or money column, variable, constant expression, or a combination of these.

decimal_places

is the number of decimal places to round to.

Examples

Example 1

select round(123.4545, 2)
---------- 
  123.4500 

Example 2

select round(123.45, -2)
---------- 
  100.00 

Example 3

select round(1.2345E2, 2)
----------------- 
       123.450000

Example 4

select round(1.2345E2, -2)
----------------- 
      100.000000

Usage

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

Any user can execute round.

See also

Functions abs, ceiling, floor, sign, str