Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 (中文) » SQL Anywhere 服务器 - SQL 参考 » 使用 SQL » SQL 函数 » SQL 函数 (P-Z)

 

TRUNCNUM 函数 [Numeric]

在小数点后的指定位数截断数字。

语法
{ TRUNCNUM | "TRUNCATE" }( numeric-expression, integer-expression )
参数
  • numeric-expression   要截断的数字。

  • integer-expression   正整数指定小数点右边舍入到的有效位数。负数表达式指定小数点左边舍入到的有效位数。

返回值

NUMERIC

注释

截断数字时应使用 TRUNCNUM 函数而不是 TRUNCATE 函数。

不建议使用 TRUNCATE 语句,因为词语 truncate 是关键字,因此需要将 quoted_identifier 选项设置为 OFF,或在词语 TRUNCATE 两侧加引号。

另请参见
标准和兼容性
  • SQL/2003   服务商扩充。

示例

以下语句返回值 600。

SELECT TRUNCNUM( 655, -2 );

以下语句返回值 655.340。

SELECT TRUNCNUM( 655.348, 2 );