portableSql

NativeRound Portable SQL Function

Syntax

NativeRound as N (Number as N, DecimalPlaces as N)

Arguments

NumberNumeric

A numeric field or value.

DecimalPlacesNumeric

The number of decimal places to round to. A value greater than or equal to zero.

Returns

resultNumeric

Returns a number using the native implementation (for Access, this is Banker's Rounding).

Description

Rounds a number using the native implementation (for Access, this is Banker's Rounding).

Discussion

The NativeRound function rounds a number using the native implementation. If the underlying database is an Access database, the number is rounded using "Banker's Rounding". Banker's Rounding rounds the number to the nearest even decimal place. For example:

NativeRound() function executed on the Northwind Access database
SELECT FIRST 1 NativeRound(5.975,2) AS EXPR1, NativeRound(10.125,2) AS EXPR2 FROM Products
 = 5.98|10.12

Other database systems, however, do not use Banker's Rounding. Here is the same example run in a MySQL database:

NativeRound() function executed on the Northwind MySQL database
SELECT FIRST 1 NativeRound(5.975,2) AS EXPR1, NativeRound(10.125,2) AS EXPR2 FROM Products
 = 5.98|10.13

See also Round and Truncate.