Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to do log10 in sql

Author  Topic 

mavershang
Posting Yak Master

111 Posts

Posted - 2009-07-08 : 12:36:38
Hi there. Just wandering whether SQL could do something mathmatically like "log10"?

Thanks

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2009-07-08 : 12:44:27
select log(100), log10(100)

___________________________________________________________________________
Causing trouble since 1980
Blog: http://weblogs.sqlteam.com/mladenp
Speed up SSMS development: www.ssmstoolspack.com <- version 1.5 out!
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-07-08 : 12:44:47
you can use LOG() function

http://doc.ddart.net/mssql/sql70/la-lz_4.htm
Go to Top of Page

mavershang
Posting Yak Master

111 Posts

Posted - 2009-07-08 : 12:45:57
Thanks guys.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-07-08 : 13:02:10
And if there should be no LOG10 function, do it with e, like this

SELECT LOG10(200) AS [10], LOG(200) / LOG(10) AS [e]


N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2009-07-08 : 13:41:07
The LOG function returns the natural logarithm of a float expression.

The LOG10 function returns the base-10 logarithm of a float expression.




CODO ERGO SUM
Go to Top of Page
   

- Advertisement -