LOG() funciton in SQL Server 2012

Posted by Bandi under Sql Server category on | Points: 40 | Views : 307
LOG() function has been enhanced in SQL Server 2012 for accepting base value as second argument...

LOG() function used to accept logarithmic value of any base. It accepts base value as second parameter. In SQL Server 2008, LOG() function doesn't accept second argument.

Syntax of LOG() in MSSQL 2012
LOG ( float_expression[, base] )

SELECT LOG(10) as Log10
,LOG(9,3) as Log10Base3
,LOG(10,2)AS Log10Base2
,LOG(10)/LOG(2) as Log10DivideByLog2

Output :
Log10	              Log10Base3	Log10Base2	        Log10DivideByLog2
2.30258509299405 2 3.32192809488736 3.32192809488736

Comments or Responses

Login to post response