Share via


RADIANS (Transact-SQL)

Si applica a:SQL Server database SQL di Azure Istanza gestita di SQL di Azure Azure Synapse Analytics AnalyticsPlatform System (PDW)SQL analytics endpoint in Microsoft FabricWarehouse in Microsoft Fabric

Restituisce l'equivalente in radianti dell'espressione numerica specificata espressa in gradi.

Convenzioni di sintassi Transact-SQL

Sintassi

RADIANS ( numeric_expression )  

Nota

Per visualizzare la sintassi Transact-SQL per SQL Server 2014 (12.x) e versioni precedenti, vedere la documentazione delle versioni precedenti.

Argomenti

numeric_expression
Espressione della categoria di tipi di dati numerici esatti o numerici approssimativi.

Tipi restituiti

Il tipo restituito dipende dal tipo di input di numeric_expression:

Input type Tipo restituito
float, real float
decimal(p, s) decimal(38, s)
int, smallint, tinyint int
bigint bigint
money, smallmoney money
bit float

Se il risultato non rientra nel tipo restituito, si verifica un errore di overflow aritmetico.

Esempi

R. Utilizzo di RADIANS con risultato 0.0

Nell'esempio seguente viene restituito il risultato 0.0 in quanto il valore dell'espressione numerica da convertire in radianti è troppo piccolo per la funzione RADIANS.

SELECT RADIANS(1e-307)  
GO  

Questo è il set di risultati.

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

B. Utilizzo di RADIANS per restituire l'angolo equivalente di un'espressione float

Nell'esempio seguente viene immessa un'espressione float e viene restituito il valore convertito da RADIANS per l'angolo specificato.

-- 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  

Questo è il set di risultati.

---------------------------------------   
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)  

Vedi anche

CAST e CONVERT (Transact-SQL)
decimal e numeric (Transact-SQL)
float e real (Transact-SQL)
int, bigint, smallint e tinyint (Transact-SQL)
Funzioni matematiche (Transact-SQL)
money e smallmoney (Transact-SQL)