LOG (Transact-SQL)LOG (Transact-SQL)
適用対象:Applies to: SQL ServerSQL Server (サポートされているすべてのバージョン)
SQL ServerSQL Server (all supported versions)
Azure SQL データベースAzure SQL Database
Azure SQL データベースAzure SQL Database
Azure SQL Managed InstanceAzure SQL Managed Instance
Azure SQL Managed InstanceAzure SQL Managed Instance
Azure Synapse AnalyticsAzure Synapse Analytics
Azure Synapse AnalyticsAzure Synapse Analytics
Parallel Data WarehouseParallel Data Warehouse
Parallel Data WarehouseParallel Data Warehouse
SQL ServerSQL Server (サポートされているすべてのバージョン)
SQL ServerSQL Server (all supported versions)
Azure SQL データベースAzure SQL Database
Azure SQL データベースAzure SQL Database
Azure SQL Managed InstanceAzure SQL Managed Instance
Azure SQL Managed InstanceAzure SQL Managed Instance
Azure Synapse AnalyticsAzure Synapse Analytics
Azure Synapse AnalyticsAzure Synapse Analytics
Parallel Data WarehouseParallel Data Warehouse
Parallel Data WarehouseParallel Data Warehouse
指定したの自然対数を返します float 内の式 SQL ServerSQL Serverです。Returns the natural logarithm of the specified float expression in SQL ServerSQL Server.
Transact-SQL 構文表記規則
Transact-SQL Syntax Conventions
構文Syntax
-- Syntax for SQL Server, Azure SQL Database
LOG ( float_expression [, base ] )
-- Syntax for Azure Synapse SQL
LOG ( float_expression )
注意
SQL Server 2014 以前の Transact-SQL 構文を確認するには、以前のバージョンのドキュメントを参照してください。To view Transact-SQL syntax for SQL Server 2014 and earlier, see Previous versions documentation.
引数Arguments
float_expressionfloat_expression
float 型、または暗黙的に float 型に変換できる 式を指定します。Is an expression of type float or of a type that can be implicitly converted to float.
basebase
対数の底を設定するオプションの整数引数です。Optional integer argument that sets the base for the logarithm.
適用対象: SQL Server 2012 (11.x)SQL Server 2012 (11.x) 以降Applies to: SQL Server 2012 (11.x)SQL Server 2012 (11.x) and later
戻り値の型Return Types
floatfloat
注釈Remarks
既定では、 を持つ LOG() 自然対数を返します。By default, LOG() returns the natural logarithm. 以降で SQL Server 2012 (11.x)SQL Server 2012 (11.x), 、対数の底を別の値に変更するには、(省略可能) を使用して 基本 パラメーター。Starting with SQL Server 2012 (11.x)SQL Server 2012 (11.x), you can change the base of the logarithm to another value by using the optional base parameter.
自然対数は e を底とする対数です。ここで、e は、2.718281828 にほぼ等しい無理定数です。The natural logarithm is the logarithm to the base e, where e is an irrational constant approximately equal to 2.718281828.
数値の指数の自然対数は、その数値自体になります。LOG( EXP( n ) ) = n。The natural logarithm of the exponential of a number is the number itself: LOG( EXP( n ) ) = n. また、数値の自然対数の指数は、その数値自体になります。EXP( LOG( n ) ) = n。And the exponential of the natural logarithm of a number is the number itself: EXP( LOG( n ) ) = n.
例Examples
A.A. 数値の自然対数を計算するCalculating the logarithm for a number.
次の例では、指定された float 式の LOG
を計算します。The following example calculates the LOG
for the specified float expression.
DECLARE @var FLOAT = 10;
SELECT 'The LOG of the variable is: ' + CONVERT(VARCHAR, LOG(@var));
GO
結果セットは次のようになります。Here is the result set.
-------------------------------------
The LOG of the variable is: 2.30259
(1 row(s) affected)
B.B. 数値の指数の自然対数を計算するCalculating the logarithm of the exponent of a number.
次の例では、数値の指数の LOG
を計算します。The following example calculates the LOG
for the exponent of a number.
SELECT LOG (EXP (10));
結果セットは次のようになります。Here is the result set.
----------------------------------
10
(1 row(s) affected)
例: Azure Synapse AnalyticsAzure Synapse Analytics、Parallel Data WarehouseParallel Data WarehouseExamples: Azure Synapse AnalyticsAzure Synapse Analytics and Parallel Data WarehouseParallel Data Warehouse
C.C. 数値の自然対数を計算するCalculating the logarithm for a number
次の例では、指定された float 式の LOG
を計算します。The following example calculates the LOG
for the specified float expression.
SELECT LOG(10);
結果セットは次のようになります。Here is the result set.
----------------`
2.30
参照See Also
数学関数 (Transact-SQL) Mathematical Functions (Transact-SQL)
EXP (Transact-SQL) EXP (Transact-SQL)
LOG10 (Transact-SQL)LOG10 (Transact-SQL)