SQL Tutorial SQL Advanced SQL Database SQL References

SQL Server - ATAN() Function



The SQL Server (Transact-SQL) ATAN() function returns arc tangent of a value. The returned value will be in the range -𝜋/2 through 𝜋/2.

Note: ATAN() is the inverse of TAN().

Syntax

ATAN(x)

Parameters

x Required. Specify the value.

Return Value

Returns the arc tangent of the value.

Example 1:

The example below shows the usage of ATAN() function.

SELECT ATAN(3);
Result: 1.2490457723982544

SELECT ATAN(0.5);
Result: 0.46364760900080609

SELECT ATAN(0);
Result: 0.0

SELECT ATAN(-0.5);
Result: -0.46364760900080609

SELECT ATAN(-3);
Result: -1.2490457723982544

Example 2:

Consider a database table called Sample with the following records:

Datax
Data 1-1
Data 2-0.5
Data 30
Data 40.5
Data 51

The query given below can be used to calculate the arc tangent of records of column x.

SELECT *, ATAN(x) AS ATAN_Value FROM Sample;

This will produce the result as shown below:

DataxATAN_Value
Data 1-1-0.78539816339744828
Data 2-0.5-0.46364760900080609
Data 300.0
Data 40.50.46364760900080609
Data 510.78539816339744828

❮ SQL Server Functions

5