Solved

Log function in Excel vs. T-SQL

Posted on 2009-05-06
5
1,140 Views
Last Modified: 2012-05-06
I am trying to do a formula in sql that I have in excel. I've cut it down to the very basics. All I want to get is LOG(0.05).

In excel I get -1.3 and in T-SQL I get -2.99.

The only difference I can think of is that in T-SQL the variable is a float.

Can someone help me or have I completely lost it?
0
Comment
Question by:jrmcintosh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 26

Accepted Solution

by:
Chris Luttrell earned 500 total points
ID: 24322614
LOG(0.05) in Excel is Base 10 by default, use LN(0.05) for log natural.
LOG(0.05) in SQL 2008 is log natural by default, use LOG10(0.05) for Log Base 10.
0
 
LVL 22

Expert Comment

by:dportas
ID: 24322639
T-SQL's LOG() is the natural logarithm. In Excel it is base 10.

So either use the LOG10() funtion in T-SQL or the LN() function in Excel.
0
 
LVL 26

Expert Comment

by:Chris Luttrell
ID: 25357531
why did you accept dportas over my answer, what is different and mine was first?
0
 
LVL 22

Expert Comment

by:dportas
ID: 25357751
I was wondering the same thing.
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Enabled trace flag 4135 or 4199 - SQL SERVER 2 25
sql update 2 39
SQL to JSON 14 41
T-SQL: Need Group By to use "fuzzy logic"?? 3 28
'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question