| title | Mathematical Functions (Transact-SQL) | |||
|---|---|---|---|---|
| description | Mathematical Transact-SQL functions in the SQL Server Database Engine. | |||
| author | markingmyname | |||
| ms.author | maghan | |||
| ms.reviewer | randolphwest | |||
| ms.date | 12/16/2024 | |||
| ms.service | sql | |||
| ms.subservice | t-sql | |||
| ms.topic | reference | |||
| ms.custom |
|
|||
| helpviewer_keywords |
|
|||
| dev_langs |
|
|||
| monikerRange | =azuresqldb-current || =azuresqldb-mi-current || >=sql-server-2016 || >=sql-server-linux-2017 || =azuresqledge-current || =azure-sqldw-latest || >=aps-pdw-2016 || =fabric || =fabric-sqldb |
[!INCLUDE sql-asdb-asdbmi-asa-pdw-fabricse-fabricdw-fabricsqldb]
The following scalar functions perform a calculation, usually based on input values that are provided as arguments, and return a numeric value:
- ABS
- ACOS
- ASIN
- ATAN
- ATN2
- CEILING
- COS
- COT
- DEGREES
- EXP
- FLOOR
- LOG
- LOG10
- PI
- POWER
- RADIANS
- RAND
- ROUND
- SIGN
- SIN
- SQRT
- SQUARE
- TAN
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're 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.