SQRT (Transact-SQL)SQRT (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
指定した浮動小数点値の平方根を返します。Returns the square root of the specified float value.
Transact-SQL 構文表記規則
Transact-SQL Syntax Conventions
構文Syntax
SQRT ( 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.
戻り値の型Return Types
floatfloat
例Examples
次の例では、1.00
から 10.00
までの値の平方根を返します。The following example returns the square root of numbers between 1.00
and 10.00
.
DECLARE @myvalue FLOAT;
SET @myvalue = 1.00;
WHILE @myvalue < 10.00
BEGIN
SELECT SQRT(@myvalue);
SET @myvalue = @myvalue + 1
END;
GO
結果セットは次のようになります。Here is the result set.
------------------------
1.0
------------------------
1.4142135623731
------------------------
1.73205080756888
------------------------
2.0
------------------------
2.23606797749979
------------------------
2.44948974278318
------------------------
2.64575131106459
------------------------
2.82842712474619
------------------------
3.0
例: Azure Synapse AnalyticsAzure Synapse Analytics、Parallel Data WarehouseParallel Data WarehouseExamples: Azure Synapse AnalyticsAzure Synapse Analytics and Parallel Data WarehouseParallel Data Warehouse
次の例は、1.00
~ 10.00
までの数値の平方根を返します。The following example returns the square root of numbers 1.00
and 10.00
.
SELECT SQRT(1.00), SQRT(10.00);
結果セットは次のようになります。Here is the result set.
---------- ------------
1.00 3.16