Solved

Log function in Excel vs. T-SQL

Posted on 2009-05-06
5
1,092 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
  • 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

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.
In this article I will describe the Copy Database Wizard 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.
This video discusses moving either the default database or any database to a new volume.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

759 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now