Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic


SQL Server 2000

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

ROUND ( numeric_expression , length [ , function ] ) 
Is an expression of the exact numeric or approximate numeric data type categories, or types that are implicitly convertible to float.
Is the precision to which numeric_expression is to be rounded. When length is a positive number, numeric_expression is rounded to the number of decimal places 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. 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.
Return Types

Returns the same type as numeric_expression except for the following expressions.

Specified expression Return type
tinyint, smallint int
real/float float
Nonnumeric types that can be implicitly converted to float float

The following example returns the unit price, rounded to the nearest dollar, of products listed in the Products table of the Northwind database.

SELECT UnitPrice, ROUND(UnitPrice, 0)
FROM Products

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft. All rights reserved.