Skip to content

Latest commit

 

History

History
95 lines (77 loc) · 2.51 KB

sqrt-transact-sql.md

File metadata and controls

95 lines (77 loc) · 2.51 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs monikerRange
SQRT (Transact-SQL)
SQRT (Transact-SQL)
MikeRayMSFT
mikeray
03/03/2017
sql
t-sql
reference
SQRT
SQRT_TSQL
SQRT function
square root values
TSQL
>= aps-pdw-2016 || = azuresqldb-current || = azure-sqldw-latest || >= sql-server-2016 || >= sql-server-linux-2017 || = azuresqldb-mi-current||=fabric

SQRT (Transact-SQL)

[!INCLUDE sql-asdb-asdbmi-asa-pdw-fabricse-fabricdw]

Returns the square root of the specified float value.

:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions

Syntax

SQRT ( float_expression )  

Arguments

float_expression
Is an expression of type float or of a type that can be implicitly converted to float.

Return Types

float

Examples

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  

Examples: [!INCLUDEssazuresynapse-md] and [!INCLUDEssPDW]

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

See Also

Mathematical Functions (Transact-SQL)