RADIANS (Transact-SQL)

Se aplica a:SQL ServerAzure SQL DatabaseAzure SQL Managed InstanceAzure Synapse AnalyticsAnalytics Platform System (PDW)Punto de conexión de análisis SQL en Microsoft FabricAlmacenamiento en Microsoft Fabric

Devuelve los radianes de una expresión numérica en grados.

Convenciones de sintaxis de Transact-SQL

Sintaxis

RADIANS ( numeric_expression )  

Nota:

Para ver la sintaxis de Transact-SQL para SQL Server 2014 (12.x) y versiones anteriores, consulte Versiones anteriores de la documentación.

Argumentos

numeric_expression
Es una expresión de la categoría de tipo de datos numéricos exactos o aproximados.

Tipos de valor devueltos

El tipo de valor devuelto depende del tipo de entrada de numeric_expression:

Tipo de entrada Tipo de valor devuelto
float, real float
decimal(p, s) decimal(38, s)
int, smallint, tinyint int
bigint bigint
money, smallmoney money
bit float

Si el resultado no cabe en el tipo de valor devuelto, se produce un error de desbordamiento aritmético.

Ejemplos

A. Utilizar RADIANS para mostrar 0.0

En este ejemplo se devuelve el resultado 0.0 debido a que la expresión numérica que se va a convertir en radianes es demasiado pequeña para la función RADIANS.

SELECT RADIANS(1e-307)  
GO  

El conjunto de resultados es el siguiente:

-------------------   
0.0                        
(1 row(s) affected)  

B. Utilizar RADIANS para devolver el ángulo equivalente de una expresión float

En este ejemplo se toma una expresión float y se devuelve el valor RADIANS del ángulo especificado.

-- First value is -45.01.  
DECLARE @angle FLOAT  
SET @angle = -45.01  
SELECT 'The RADIANS of the angle is: ' +  
   CONVERT(VARCHAR, RADIANS(@angle))  
GO  
-- Next value is -181.01.  
DECLARE @angle FLOAT  
SET @angle = -181.01  
SELECT 'The RADIANS of the angle is: ' +  
   CONVERT(VARCHAR, RADIANS(@angle))  
GO  
-- Next value is 0.00.  
DECLARE @angle FLOAT  
SET @angle = 0.00  
SELECT 'The RADIANS of the angle is: ' +  
   CONVERT(VARCHAR, RADIANS(@angle))  
GO  
-- Next value is 0.1472738.  
DECLARE @angle FLOAT  
SET @angle = 0.1472738  
SELECT 'The RADIANS of the angle is: ' +  
    CONVERT(VARCHAR, RADIANS(@angle))  
GO  
-- Last value is 197.1099392.  
DECLARE @angle FLOAT  
SET @angle = 197.1099392  
SELECT 'The RADIANS of the angle is: ' +  
   CONVERT(VARCHAR, RADIANS(@angle))  
GO  

El conjunto de resultados es el siguiente:

---------------------------------------   
The RADIANS of the angle is: -0.785573                        
(1 row(s) affected)  
---------------------------------------   
The RADIANS of the angle is: -3.15922                         
(1 row(s) affected)  
---------------------------------------   
The RADIANS of the angle is: 0                                
(1 row(s) affected)  
---------------------------------------   
The RADIANS of the angle is: 0.00257041                       
 (1 row(s) affected)  
---------------------------------------   
The RADIANS of the angle is: 3.44022                          
(1 row(s) affected)  

Consulte también

CAST y CONVERT (Transact-SQL)
decimal y numeric (Transact-SQL)
float y real (Transact-SQL)
int, bigint, smallint y tinyint (Transact-SQL)
Funciones matemáticas (Transact-SQL)
money y smallmoney (Transact-SQL)