Funzione LOG() di SQL Server
Esempio
Restituisce il logaritmo naturale di 2:
SELECT LOG(2);
Definizione e utilizzo
La funzione LOG() restituisce il logaritmo naturale di un numero specificato o il logaritmo del numero alla base specificata .
Da SQL Server 2012 è anche possibile modificare la base del logaritmo in un altro valore usando il parametro di base facoltativo.
Nota: guarda anche la funzione EXP() .
Sintassi
LOG(number, base) -- Syntax for SQL Server
O:
LOG(number) -- Syntax for Azure SQL Database, Azure SQL Data Warehouse, Parallel Data Warehouse
Valori dei parametri
Parameter | Description |
---|---|
number | Required. The number to return the natural logarithm of. Must be greater than 0 |
base | Optional. The base the natural logarithm is to be calculated with. Must be greater than 1 |
Dettagli tecnici
Funziona in: | SQL Server (a partire dal 2008), Database SQL di Azure, Azure SQL Data Warehouse, Parallel Data Warehouse |
---|
Altri esempi
Esempio
Restituisci il logaritmo naturale di 2 su una base specificata (4):
SELECT LOG(2, 4);