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

SQL Server - DEGREES() Function



The SQL Server (Transact-SQL) DEGREES() function returns an angle measured in radians to an approx. equivalent angle measured in degrees.

Syntax

DEGREES(x)

Parameters

x Required. Specify an angle in radians.

Return Value

Returns the angle measured in degrees (data type of returned value matches with x).

Example 1:

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

SELECT DEGREES(0);
Result: 0

SELECT DEGREES(1.0);
Result: 57.295779513082322865

SELECT DEGREES(2.0);
Result: 114.591559026164645729

SELECT DEGREES(3.0);
Result: 171.887338539246968594

SELECT DEGREES(PI()/3);
Result: 59.999999999999993

SELECT DEGREES(PI()/2);
Result: 90.0

SELECT DEGREES(PI());
Result: 180.0

Example 2:

Consider a database table called Sample with the following records:

Datax
Data 10.0
Data 21.0
Data 32.0
Data 43.0
Data 54.0

The query given below can be used to convert the records of column x (containing values expressed in radians) into degrees.

SELECT *, DEGREES(x) AS DEGREES_Value FROM Sample;

This will produce the result as shown below:

DataxDEGREES_Value
Data 10.00.0
Data 21.057.295779513082322865
Data 32.0114.591559026164645729
Data 43.0171.887338539246968594
Data 54.0229.183118052329291459

❮ SQL Server Functions

5