DEGREES (Transact-SQL)

適用於:Microsoft Fabric 中 Microsoft Fabric倉儲中的 SQL ServerAzure SQL 資料庫 Azure SQL 受控執行個體 Azure SynapseAnalytics Analytics Platform System (PDW)SQL 分析端點

此函式會針對以弧度指定的角度,傳回對應的角度 (以度數為單位)。

Transact-SQL 語法慣例

Syntax

DEGREES ( numeric_expression )  

注意

若要檢視 SQL Server 2014 (12.x) 和舊版的 Transact-SQL 語法,請參閱 舊版檔

引數

numeric_expression
精確數值或近似數值資料類型目錄的運算式

傳回型別

傳回類型取決於numeric_expression輸入類型:

輸入類型 傳回類型
floatreal float
decimal(p, s) decimal(38, s)
intsmallinttinyint int
bigint bigint
moneysmallmoney money
bit float

如果結果不符合傳回型別,就會發生算術溢位錯誤。

範例

此範例會傳回 PI/2 弧度中的角度度數。

SELECT 'The number of degrees in PI/2 radians is: ' +   
CONVERT(VARCHAR, DEGREES((PI()/2)));  
GO  

以下為結果集。

The number of degrees in PI/2 radians is 90         
  
(1 row(s) affected)  

另請參閱

數學函數 (Transact-SQL)