SQL ATAN Function

The SQL Server ATAN function is a Mathematical Function that calculates the trigonometry Arc tangent for the specified expression. The SQL Arc tangent is also called the inverse of a TANGENT Function.

The syntax of the SQL ATAN Function is

SELECT ATAN (Float_Expression)
FROM [Source]

For this demo, we use the below shown Math Table data

Source Table 1

SQL ATAN Function Example

It calculates the Arctangent value for the given angle. The following query shows multiple ways to use the ATAN function.

We used the Mathematical Function to calculate the Arc TANGENT value for the variable @i. It means ATAN(-208.80)) and assigned a new name, ‘Arc Tangent’ using ALIAS.

DECLARE @i Float
SET @i = -208.80

SELECT ATAN(@i) AS [Arc Tangent]

-- Calculating ATAN directly
SELECT ATAN(0.27) AS [Arc Tangent]

-- Calculating ATAN directly
SELECT ATAN(22.25 + 78.55 - 140.77) AS [Arc Tangent]
SQL ATAN Function or Arc Tangent Example 1

ATAN Function Example 2

We are going to calculate the Arctangent value for all the records present in [Service Grade] using this SQL Serve Function

SELECT [EnglishProductName]
      ,[Color]
      ,[StandardCost]
      ,[SalesAmount]
      ,[Service Grade] AS Grade
      ,ATAN([Service Grade]) AS [Arc Tangent] 
  FROM [Mathemetical Functions]
SQL ATAN FUNCTION 2
Categories SQL

Comments are closed.