ABS (Azure Cosmos DB)ABS (Azure Cosmos DB)

适用于: SQL API

返回指定数值表达式的绝对(正)值。Returns the absolute (positive) value of the specified numeric expression.

语法Syntax

ABS (<numeric_expr>)  

参数Arguments

numeric_exprnumeric_expr
是一个数值表达式。Is a numeric expression.

返回类型Return types

返回一个数值表达式。Returns a numeric expression.

示例Examples

以下示例演示了对三个不同数字使用 ABS 函数的结果。The following example shows the results of using the ABS function on three different numbers.

SELECT ABS(-1) AS abs1, ABS(0) AS abs2, ABS(1) AS abs3 

下面是结果集。Here is the result set.

[{abs1: 1, abs2: 0, abs3: 1}]  

备注Remarks

此系统函数将从范围索引中获益。This system function will benefit from a range index.

后续步骤Next steps