ATN2 (Transact-SQL)

THIS TOPIC APPLIES TO: yesSQL Server (starting with 2008)yesAzure SQL DatabaseyesAzure SQL Data Warehouse yesParallel Data Warehouse

Returns the angle, in radians, between the positive x-axis and the ray from the origin to the point (y, x), where x and y are the values of the two specified float expressions.

Topic link icon Transact-SQL Syntax Conventions

Syntax

-- Syntax for SQL Server, Azure SQL Database, Azure SQL Data Warehouse, Parallel Data Warehouse  

ATN2 ( float_expression , float_expression )  

Arguments

float_expression
Is an expression of the float data type.

Return Types

float

Examples

The following example calculates the ATN2 for the specified x and y components.

DECLARE @x float = 35.175643, @y float = 129.44;  
SELECT 'The ATN2 of the angle is: ' + CONVERT(varchar,ATN2(@x,@y ));  
GO  

Here is the result set.

The ATN2 of the angle is: 0.265345                         
(1 row(s) affected)  

Examples: Azure SQL Data Warehouse and Parallel Data Warehouse

The following example calculates the ATN2 for the specified x and y components.

DECLARE @x float = 35.175643, @y float = 129.44;  
SELECT 'The ATN2 of the angle is: ' + CONVERT(varchar,ATN2(@x,@y ));  
GO  

Here is the result set.

The ATN2 of the angle is: 0.265345                         
(1 row(s) affected)  

See Also

CAST and CONVERT (Transact-SQL)
float and real (Transact-SQL)
Mathematical Functions (Transact-SQL)