RADIANS (Transact-SQL)
Aplica-se a:SQL ServerBanco de Dados SQL do AzureInstância Gerenciada de SQL do AzureAzure Synapse AnalyticsPDW (Analytics Platform System)Ponto de extremidade de SQL no Microsoft FabricWarehouse no Microsoft Fabric
Retorna radianos quando uma expressão numérica, em graus, é inserida.
Convenções de sintaxe de Transact-SQL
Sintaxe
RADIANS ( numeric_expression )
Observação
Para exibir a sintaxe do Transact-SQL para o SQL Server 2014 (12.x) e versões anteriores, confira a Documentação das versões anteriores.
Argumentos
numeric_expression
É uma expressão da categoria de tipo de dados numéricos aproximados ou exatos.
Tipos de retorno
O tipo de retorno depende do tipo de entrada da numeric_expression:
Tipo de entrada | Tipo de retorno |
---|---|
float, real | float |
decimal(p, s) | decimal(38, s) |
int, smallint, tinyint | int |
bigint | bigint |
money, smallmoney | money |
bit | float |
Se o resultado não se adequar ao tipo de retorno, ocorrerá um erro de estouro aritmético.
Exemplos
a. Usando RADIANS para mostrar 0,0
O exemplo a seguir retorna um resultado de 0.0
porque a expressão numérica a ser convertida em radianos é muito pequena para a função RADIANS
.
SELECT RADIANS(1e-307)
GO
Este é o conjunto de resultados.
-------------------
0.0
(1 row(s) affected)
B. Usando RADIANS para retornar o ângulo equivalente de uma expressão flutuante.
O exemplo a seguir usa uma expressão float
e retorna os RADIANS
do â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
Este é o conjunto de resultados.
---------------------------------------
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 Também
CAST e CONVERT (Transact-SQL)
decimal e numeric (Transact-SQL)
flutuante e real (Transact-SQL)
int, bigint, smallint e tinyint (Transact-SQL)
Funções matemáticas (Transact-SQL)
money e smallmoney (Transact-SQL)
Comentários
https://aka.ms/ContentUserFeedback.
Brevemente: Ao longo de 2024, vamos descontinuar progressivamente o GitHub Issues como mecanismo de feedback para conteúdos e substituí-lo por um novo sistema de feedback. Para obter mais informações, veja:Submeter e ver comentários