SQL Server - RADIANS() Function
The SQL Server (Transact-SQL) RADIANS() function returns an angle measured in degrees to an approx. equivalent angle measured in radians.
Syntax
RADIANS(x)
Parameters
x |
Required. Specify an angle in degrees. |
Return Value
Returns the angle measured in radians (data type of returned value matches with x).
Example 1:
The example below shows the usage of RADIANS() function.
SELECT RADIANS(0); Result: 0 SELECT RADIANS(30.0); Result: 0.5235987755982988 SELECT RADIANS(60.0); Result: 1.0471975511965976 SELECT RADIANS(90.0); Result: 1.5707963267948966 SELECT RADIANS(180.0); Result: 3.141592653589793 SELECT RADIANS(-90.0); Result: -1.5707963267948966 SELECT RADIANS(-180.0); Result: -3.141592653589793
Example 2:
Consider a database table called Sample with the following records:
Data | x |
---|---|
Data 1 | 0.0 |
Data 2 | 30.0 |
Data 3 | 60.0 |
Data 4 | 90.0 |
Data 5 | 180.0 |
The statement given below can be used to convert the records of column x (containing values expressed in degrees) into radians.
SELECT *, RADIANS(x) AS RADIANS_Value FROM Sample;
This will produce the result as shown below:
Data | x | RADIANS_Value |
---|---|---|
Data 1 | 0.0 | 0 |
Data 2 | 30.0 | 0.5235987755982988 |
Data 3 | 60.0 | 1.0471975511965976 |
Data 4 | 90.0 | 1.5707963267948966 |
Data 5 | 180.0 | 3.141592653589793 |
❮ SQL Server Functions