Mathematical Functions (Transact-SQL)
APPLIES TO:
SQL Server
Azure SQL Database
Azure SQL Data Warehouse
Parallel Data Warehouse
The following scalar functions perform a calculation, usually based on input values that are provided as arguments, and return a numeric value:
| ABS | DEGREES | RAND |
| ACOS | EXP | ROUND |
| ASIN | FLOOR | SIGN |
| ATAN | LOG | SIN |
| ATN2 | LOG10 | SQRT |
| CEILING | PI | SQUARE |
| COS | POWER | TAN |
| COT | RADIANS |
Note
Arithmetic functions, such as ABS, CEILING, DEGREES, FLOOR, POWER, RADIANS, and SIGN, return a value having the same data type as the input value. Trigonometric and other functions, including EXP, LOG, LOG10, SQUARE, and SQRT, cast their input values to float and return a float value.
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 is deterministic only when a seed parameter is specified. For more information about function determinism, see Deterministic and Nondeterministic Functions.
本文详细介绍了SQL中的数学函数,包括三角函数、指数函数等,并解释了这些函数如何应用于输入值来执行各种计算任务。文中还特别说明了这些函数的数据类型转换规则及确定性特点。

357

被折叠的 条评论
为什么被折叠?



