| title | SQRT (Transact-SQL) | Microsoft Docs | ||
|---|---|---|---|
| ms.custom | |||
| ms.date | 03/03/2017 | ||
| ms.prod | sql-non-specified | ||
| ms.reviewer | |||
| ms.suite | |||
| ms.technology |
|
||
| ms.tgt_pltfrm | |||
| ms.topic | language-reference | ||
| f1_keywords |
|
||
| dev_langs |
|
||
| helpviewer_keywords |
|
||
| ms.assetid | 26e244e8-e82d-4664-a445-1226230ee1c5 | ||
| caps.latest.revision | 37 | ||
| author | BYHAM | ||
| ms.author | rickbyh | ||
| manager | jhubbard |
[!INCLUDEtsql-appliesto-ss2008-all_md]
Returns the square root of the specified float value.
Transact-SQL Syntax Conventions
-- Syntax for SQL Server, Azure SQL Database, Azure SQL Data Warehouse, Parallel Data Warehouse
SQRT ( float_expression )
float_expression
Is an expression of type float or of a type that can be implicitly converted to float.
float
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
[!INCLUDEssResult]
------------------------
1.0
------------------------
1.4142135623731
------------------------
1.73205080756888
------------------------
2.0
------------------------
2.23606797749979
------------------------
2.44948974278318
------------------------
2.64575131106459
------------------------
2.82842712474619
------------------------
3.0
The following example returns the square root of numbers 1.00 and 10.00.
SELECT SQRT(1.00), SQRT(10.00);
[!INCLUDEssResult]
---------- ------------
1.00 3.16