SQL Server RADIANS() Function

In Sql Server, the RADIANS() function is used to convert angle values to radian values. This function is a mathematical function and is commonly used in mathematical calculations where angle values need to be converted to radian values.

Syntax

The syntax for the RADIANS() function is:

RADIANS(angle)

Parameters:

  • angle: Required. The angle value to be converted.

Return value:

  • Returns a float value representing the radian value of the angle.

Usage

In many mathematical calculations, radian values are required instead of angle values. For example, trigonometric functions commonly use radians as units. In such cases, the RADIANS() function is used to convert angles to radians.

Examples

Here are two examples of using the RADIANS() function:

Example 1

Assume that there is a table test with a column angle that stores some angle values. Now we need to convert these angle values to radians and calculate their sine values.

Suppose the test table contains the following data:

angle
30
45
60

The following is the query statement:

SELECT SIN(RADIANS(angle)) AS sin_value
FROM test;

Running the above SQL statement will result in the following output:

sin_value
0.5
0.7071067811865475
0.8660254037844386

Example 2

Now we need to calculate the hypotenuse length of a right triangle with an angle of 45 degrees. We can use the following SQL statement:

SELECT 10 / COS(RADIANS(45)) AS hypotenuse;

Running the above SQL statement will result in the following output:

hypotenuse
14.142135623731

Conclusion

The RADIANS() function is used to convert angle values to radian values and is commonly used in mathematical calculations such as trigonometric functions.