Solved

Log function in Excel vs. T-SQL

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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

863 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

23 Experts available now in Live!

Get 1:1 Help Now