?
Solved

Log function in Excel vs. T-SQL

Posted on 2009-05-06
5
Medium Priority
?
1,181 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 27

Accepted Solution

by:
Chris Luttrell earned 2000 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 27

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

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

801 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