適用於:SQL Server
Azure SQL 資料庫
Azure SQL 受控執行個體
Azure Synapse Analytics
分析平台系統(PDW)
Microsoft Fabric 中的 SQL 分析端點
Microsoft Fabric 中的倉儲
Microsoft Fabric 中的 SQL 資料庫
此函式會針對以弧度指定的角度,傳回對應的角度 (以度數為單位)。
語法
DEGREES ( numeric_expression )
引數
numeric_expression
精確數值或近似數值資料類型目錄的運算式。
傳回型別
傳回類型取決於numeric_expression的輸入類型:
| 輸入類型 | 傳回類型 |
|---|---|
| float、real | float |
| 十進位(p, s) | 十進位(38,s) |
| int、smallint、tinyint | int |
| bigint | bigint |
| money、 smallmoney | 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)