SIGN (Azure Cosmos DB)SIGN (Azure Cosmos DB)
适用于:
SQL API
返回指定数值表达式的正数 (+1)、零 (0) 或负数 (-1)。Returns the positive (+1), zero (0), or negative (-1) sign of the specified numeric expression.
语法Syntax
SIGN(<numeric_expr>)
参数Arguments
numeric_exprnumeric_expr
是一个数值表达式。Is a numeric expression.
返回类型Return types
返回一个数值表达式。Returns a numeric expression.
示例Examples
以下示例返回数字 -2 到 2 的 SIGN
值。The following example returns the SIGN
values of numbers from -2 to 2.
SELECT SIGN(-2) AS s1, SIGN(-1) AS s2, SIGN(0) AS s3, SIGN(1) AS s4, SIGN(2) AS s5
下面是结果集。Here is the result set.
[{s1: -1, s2: -1, s3: 0, s4: 1, s5: 1}]
备注Remarks
此系统函数不会使用索引。This system function will not utilize the index.