SQL Server RADIANS() Function
RADIANS() converts an angle measured in degrees to radians. Its return type depends on the input type. In particular, an integer input returns int; convert integer angles to float when fractional radians are needed. See Microsoft’s RADIANS() reference.
Syntax
RADIANS(numeric_expression)
numeric_expression must be an exact or approximate numeric expression.
Return type
The return type depends on the input type:
| Input type | Return type |
|---|---|
float, real |
float |
decimal(p, s) |
decimal(38, s) |
int, smallint, tinyint |
int |
bigint |
bigint |
money, smallmoney |
money |
bit |
float |
SQL Server raises an arithmetic overflow error if the result does not fit in the return type.
Example: Convert degrees before using a trigonometric function
Trigonometric functions such as SIN() take a radian-valued input. Convert an integer degree value to float first to preserve the fractional radians:
DECLARE @degrees int = 30;
SELECT RADIANS(CONVERT(float, @degrees)) AS radians,
SIN(RADIANS(CONVERT(float, @degrees))) AS sine_value;
| radians | sine_value |
|---|---|
| 0.523598775598299 | 0.5 |
For the inverse conversion, use DEGREES().