Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.
在小数点后的指定位数截断数字。
{ TRUNCNUM | TRUNCATE }( numeric-expression, integer-expression )
numeric-expression 要截断的数字。该参数可以是 NUMERIC 或 DOUBLE 类型。
integer-expression 正整数指定小数点右边舍入到的有效位数。负值指定小数点左边舍入到的有效位数。
NUMERIC 或 DOUBLE
截断数字时应使用 TRUNCNUM 函数而不是 TRUNCATE 函数。
不建议使用 TRUNCATE 函数,因为词语 truncate 是关键字,所以需要将 quoted_identifier 选项设置为 OFF,或在词语 TRUNCATE 两侧加引号。
SQL/2008 服务商扩充。
以下语句返回值 600。
SELECT TRUNCNUM( 655, -2 );
以下语句返回值 655.340。
SELECT TRUNCNUM( 655.348, 2 );