SQL Server Tutorial SQL Server Advanced SQL Server Database SQL Server References

SQL Server - SIN() Function



The SQL Server (Transact-SQL) SIN() function returns trigonometric sine of an angle (angle should be in radians).

Syntax

SIN(x)

Parameters

x Required. Specify the angle in radian.

Return Value

Returns the trigonometric sine of an angle.

Example 1:

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

SELECT SIN(0);
Result: 0.0

SELECT SIN(1);
Result: 0.8414709848078965

SELECT SIN(-1);
Result: -0.8414709848078965

SELECT SIN(2);
Result: 0.90929742682568171

SELECT SIN(-2);
Result: -0.90929742682568171

SELECT SIN(PI());
Result: 1.2246467991473532E-16

Example 2:

Consider a database table called Sample with the following records:

Datax
Data 1-10
Data 2-5
Data 30
Data 45
Data 510

The query given below can be used to calculate the trigonometric sine value of column x.

SELECT *, SIN(x) AS SIN_Value FROM Sample;

This will produce the result as shown below:

DataxSIN_Value
Data 1-100.54402111088936977
Data 2-50.95892427466313845
Data 300.0
Data 45-0.95892427466313845
Data 510-0.54402111088936977

❮ SQL Server Functions

5