TRUNCATE
Rounds the input expression down the nearest of equal integer depending on the specified number of places before or after the decimal point.
Syntax
TRUNCATE(numeric_expression float) → int
numeric_expression: The numeric expression to truncate.
Examples
TRUNCATE(numeric_expression double) → int
numeric_expression: The numeric expression to truncate.
Examples
TRUNCATE(numeric_expression int32) → int32
numeric_expression: The numeric expression to truncate.
Examples
TRUNCATE(numeric_expression int64) → int64
numeric_expression: The numeric expression to truncate.
Examples
TRUNCATE(numeric_expression decimal(0,0), scale_expression int32) → decimal(0,0)
numeric_expression: The numeric expression to truncate.
scale_expression: sample parameter description
Examples
TRUNCATE(numeric_expression int64, scale_expression int32) → int64
numeric_expression: The numeric expression to truncate.
scale_expression: sample parameter description
Examples
TRUNCATE(numeric_expression decimal(0,0)) → decimal(0,0)
numeric_expression: The numeric expression to truncate.
Examples
TRUNCATE(numeric_expression float, scale_expression int32) → float
numeric_expression: The numeric expression to truncate.
scale_expression: The decimal place to round to.
Examples
TRUNCATE(numeric_expression int32, scale_expression int32) → int32
numeric_expression: The numeric expression to truncate.
scale_expression: The decimal place to round to.
Examples
TRUNCATE(numeric_expression double, scale_expression int32) → double
numeric_expression: The numeric expression to truncate.
scale_expression: The decimal place to round to.
Examples
Usage Notes
To round to a place after the decimal point, specify the position as a positive number. To round to a place before the decimal point, specify the position as a negative number. To round to the nearest whole number, specify 0. If no decimal position is specified, then the function rounds to the nearest whole number (assumes 0 as the scale expression).
Last updated