数学函数 (Transact-SQL)Mathematical Functions (Transact-SQL)

适用于: 是SQL Server 是Azure SQL 数据库 是Azure Synapse Analytics (SQL DW) 是并行数据仓库 APPLIES TO: YesSQL Server YesAzure SQL Database YesAzure Synapse Analytics (SQL DW) YesParallel Data Warehouse

下列标量函数通常基于作为参数提供的输入值执行计算,并返回一个数值:The following scalar functions perform a calculation, usually based on input values that are provided as arguments, and return a numeric value:

ABSABS DEGREESDEGREES RANDRAND
ACOSACOS EXPEXP ROUNDROUND
ASINASIN FLOORFLOOR SIGNSIGN
ATANATAN LOGLOG SINSIN
ATN2ATN2 LOG10LOG10 SQRTSQRT
CEILINGCEILING PIPI SQUARESQUARE
COSCOS POWERPOWER TANTAN
COTCOT RADIANSRADIANS

备注

算术函数(例如 ABS、CEILING、DEGREES、FLOOR、POWER、RADIANS 和 SIGN)返回与输入值具有相同数据类型的值。Arithmetic functions, such as ABS, CEILING, DEGREES, FLOOR, POWER, RADIANS, and SIGN, return a value having the same data type as the input value. 三角函数和其他函数(包括 EXP、LOG、LOG10、SQUARE 和 SQRT)将输入值转换为 float 并返回 float 值 。Trigonometric and other functions, including EXP, LOG, LOG10, SQUARE, and SQRT, cast their input values to float and return a float value.

除 RAND 以外的所有数学函数都为确定性函数。All mathematical functions, except for RAND, are deterministic functions. 这意味着在每次使用特定的输入值集调用这些函数时,它们都将返回相同的结果。This means they return the same results each time they are called with a specific set of input values. 仅当指定种子参数时 RAND 才是确定性函数。RAND is deterministic only when a seed parameter is specified. 有关函数确定性的详细信息,请参阅确定性函数和不确定性函数For more information about function determinism, see Deterministic and Nondeterministic Functions.

另请参阅See Also

算术运算符 (Transact-SQL)Arithmetic Operators (Transact-SQL)
内置函数 (Transact-SQL)Built-in Functions (Transact-SQL)