The SQL Server LOG10 function is a Mathematical function that calculates the base 10 logarithmic value of the given float value and its syntax is
SELECT LOG10 (Float_Expression) FROM [Source]
SQL Server LOG10 Function Example
The LOG10 Function is useful to calculate the logarithmic value of a given float value with the user-specified base value. In this SQL SELECT query, we are going to check the same with different data and display the output.
DECLARE @i float SET @i = 10 SELECT LOG10(@i)AS [LOG10 Result 1] -- Calculating it directly SELECT LOG10(1) AS [LOG10 Result 2] SELECT LOG10(62.9876) AS [LOG Result 3] SELECT LOG10(120.85 + 213.17 - 220.50 + 15.09) AS [LOG10 Result 4]

Within this LOG10 Function example query, we are calculating the logarithmic value of @i base 10. Next, we used the function directly on the SQL Server float values. Please refer to the list of SQL Mathematical functions from our SQL Server tutorial page.
LOG10 Example 2
In the following SELECT query, we will calculate the base 10 logarithmic value of all the records present in the [DealerPrice] and [Tax Amount] using the math LOG10 function.
Please refer to the SQL LOG (natural logarithm), SQL EXP, and SQL POWER functions from the list of available Mathematical functions.
SELECT [EnglishProductName]
,[Color]
,[StandardCost]
,[ListPrice]
,[DealerPrice]
,LOG10([DealerPrice]) AS [Dealer_Log result]
,[SalesAmount]
,[TaxAmt]
,LOG10([TaxAmt]) AS [Tax_Log result]
FROM [Prod Sales]
