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.4636476090008061

SELECT ATAN(0);
Result: 0

SELECT ATAN(-0.5);
Result: -0.4636476090008061

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 statement 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.7853981633974483
Data 2-0.5-0.4636476090008061
Data 300
Data 40.50.4636476090008061
Data 510.7853981633974483

❮ SQL Server Functions