Icon TRUNCATE

Truncates a numeric argument to the specified number of decimal places.

Syntax
TRUNCATE(<NumericExpression> [TO <IntegerExpression>])
TRUNCATE(<NumericExpression> [, <IntegerExpression>])
TRUNC(<NumericExpression> [TO <IntegerExpression>])
TRUNC(<NumericExpression> [, <IntegerExpression>])

<NumericExpression> =

Type of:

SMALLINT
INTEGER|INT
BIGINT
FLOAT
DECIMAL|NUMERIC

<IntegerExpression> =

Type of:

SMALLINT
INTEGER|INT
BIGINT

Returns
Same as input

Usage
The TRUNC or TRUNCATE function truncates a numeric value to a specified number of decimal places. The number of decimal places is optional, and if not specified the value returned will be truncated to 0 decimal places.

Information If using the TRUNC or TRUNCATE function with FLOAT or DOUBLE PRECISION values and a number of decimal places greater than 0, it is possible to encounter truncation errors due to the nature of floating-point values and their inability to accurately express certain fractional real numbers.

Examples
SELECT SUM(TRUNCATE(Distance TO 2)) AS ApproxDistance
FROM Destinations

SQL 2003 Standard Deviations
This function deviates from the SQL 2003 standard in the following ways:

DeviationDetails
ExtensionThis function is an ElevateDB extension.
Image