SQL Server LOG10() Function
The LOG10()
function in SQL Server calculates the base-10 logarithm of a number. In simpler terms, it answers the question: "To what power must I raise 10 to get this number?"
LOG10(): Definition and Usage
Logarithms are fundamental in mathematics and are used in various applications, such as data scaling, signal processing, and modeling exponential growth or decay. The base-10 logarithm is particularly useful when dealing with orders of magnitude or working with data that spans several powers of 10.
Related Function
For natural logarithms (base *e*), see the LOG()
function.
Syntax
Syntax
LOG10(number)
Parameter Values
Parameter | Description |
---|---|
number |
The number for which you want to calculate the base-10 logarithm. This must be greater than 0. This is required. |
Examples
Base-10 Logarithm of 2
This example calculates log10(2).
Syntax
SELECT LOG10(2);
Output
0.301029995663981
Base-10 Logarithm of 4.5
Calculating log10(4.5).
Syntax
SELECT LOG10(4.5);
Output
0.65321251377535
Technical Details
The LOG10()
function is supported in:
- SQL Server (starting with version 2008)
- Azure SQL Database
- Azure SQL Data Warehouse
- Parallel Data Warehouse