Returns a numeric expression, rounded to the specified number of decimal places. The DbRound function rounds a number according to the behavior of the SQL database. The returned value is different than the value returned from the Magic xpa Round function.
Syntax:
DbRound(numeric_expression,length)
Parameters:
numeric_expression – An expression of a numeric variable or constant.
length – The number of decimal places to which the numeric expression is rounded. It's required that the length be a numeric value. When the length is a positive number, the numeric expression is rounded to the number of decimal places specified by the length. When the length is a negative number, the numeric expression is rounded to the left side of the decimal point.
Returns:
Returns a numeric value.
Note:
DbRound always returns a numeric value. If the length is negative and larger than the number of digits to the left of the decimal point, the DbRound function returns 0.
Examples:
DbRound(657.4545,2) = 657.45
DbRound(657.4552,2) = 657.46
DbRound(657.37,-4) = 0
DbRound(657.37,-1) = 660.00
DbRound(657.37,-2) = 700.00
DbRound(657.37,-3) = 1000.00
Exceptions:
This function is not supported for IMDG (Space) and Web Service databases.
See also:
The Online and Rich Client Samples projects (program SQ14 and RSQ14)