Home > T-SQL > Trigonometric Functions SIN, COS, TAN in SQL Server – Math Functions @SQLSERVER

## Trigonometric Functions SIN, COS, TAN in SQL Server – Math Functions @SQLSERVER

Trigonometric or circular functions are functions of an angle. They are used to relate the angles of a triangle to the lengths of the sides of a triangle. – Wikipedia

These function are playing a vital role in navigation, engineering and physics. We have these functions in SQL Server. So, it is simple to do the trigonometric calculation in the database.

SQL Server Trigonometric Functions:

1. sin(angle)        –  It returns sine of the specified angle in radians float value
2. asine(sine)       – It returns the angle of the sine value in radians float value.
3. cos(angle)        – It returns the cosine of the specified angle in radians float value.
4. acos(cos)          – It returns the angle of the cosine in radians float value.
5. cot(angle)         – It returns the cotangent of the specified angle in radians float value.
6. tan(angle)        – It returns the tangent of the given angle and it returns a float value.
7. atan(tangent)  – It returns the angle in radians of the given tangent float value.
8. atn2(x,y)       – It returns the angle in radians between the positive x-axis and the ray from the origin to the point (y, x). Here x and y are float values.

Implementation

SQL Script:

set nocount on
select Sin(45) as ‘SIN’
select asin(Sin(45)) ‘ASIN’select cos(30) as ‘COS’
select acos(cos(30)) as ‘ACOS’
select cot(30) as ‘COT’select tan(120) as ‘TAN’
select atan(tan(120)) as ‘ATAN’
select atn2(1.5, 2) as ‘ATN2’

We have learned trigonometric functions in SQL Server. So, make use of these functions in your application at data access layer.