LOG function in SQL Server and Excel are giving different values:

Thursday, May 7, 2009 |

LOG, wow, I have used it in my studies somewhere!!!! J

Anyway, You may be wonder when you use LOG function in Excel and in SQL Server. You will get different values in both LOG function, Is It bug? NO, IT IS NOT.

First of all, let us try it practically. Open your Excel workbook and type =LOG(1.5) in any of the cell and you will get results 0.176091 and when you try to do the same in SQL Server by executing following command, you will get results 0.405465108108164.

select LOG(1.5) --results will be 0.405465108108164

Why these are behaving like that? Well, there is a reason, when you execute LOG function is excel, it will have base 10 and in SQL Server LOG function is by default natural. If you want to get same results like SQL Server in Excel use =LN(1.5) rather than =Log(1.5).

In SQL Server, if you want to get same results as =LOG(1.5) of Excel than use  select LOG10(1.5)  rather than  select LOG(1.5).

Reference: Ritesh Shah
Note: Microsoft Books online is a default reference of all articles but examples and explanations prepared by Ritesh Shah, founder of