Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

SQRT (Transact-SQL)

Applies To: SQL Server 2014, SQL Server 2016 Preview

Topic Status: Some information in this topic is preview and subject to change in future releases. Preview information describes new features or changes to existing features in Microsoft SQL Server 2016 Community Technology Preview 2 (CTP2).

Returns the square root of the specified float value.

Applies to: SQL Server (SQL Server 2008 through current version), Azure SQL Database, Azure SQL Data Warehouse Public Preview.

Topic link icon Transact-SQL Syntax Conventions

SQRT ( float_expression )

float_expression

Is an expression of type float or of a type that can be implicitly converted to 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

Here is the result set.

------------------------ 
1.0                      
------------------------ 
1.4142135623731          
------------------------ 
1.73205080756888         
------------------------ 
2.0                      
------------------------ 
2.23606797749979         
------------------------ 
2.44948974278318         
------------------------ 
2.64575131106459         
------------------------ 
2.82842712474619         
------------------------ 
3.0

Community Additions

ADD
Show:
© 2015 Microsoft