The SQL ASIN is one of the Mathematical Function which is used to calculate the trigonometry Arc sine for the specified expression. Arc sine is also called as inverse of a Sine, Please refer SQL SIN Function article to understand the Sine Function.
SQL ASIN Function Syntax
In SQL Server, The basic syntax of the ASIN Function is:
SELECT ASIN (Float_Expression) FROM [Source]
TIP: The ASIN function only accepts float values between -1 and 1.
In this article we will show you, How to write ASIN Function in SQL Server with example. For this, We are going to use the below shown data
SQL ASIN Function Example 1
The SQL ASIN Function is used to calculate the Arcsine for given angle. The following query will show multiple ways to use ASIN function.
DECLARE @i Float SET @i = -0.80 SELECT ASIN(@i)AS [Arc Sine] -- Calculating ASIN directly SELECT ASIN(0.27)AS [Arc Sine] -- Calculating ASIN directly SELECT ASIN(0.25 + 0.55 - 0.77)AS [Arc Sine]
Below lines of code is used to declare float variable and assigning the value.
DECLARE @i Float SET @i = -0.80
In the below statement, We used ASIN function to calculate the Arcsine value for the variable @i (It means ASIN(-0.80)). We also assigned new name to that result as ‘Arc Sine’ using SQL ALIAS Column.
SELECT ASIN(@i)AS [Arc Sine]
In the next statements, We used the ASIN Function directly on the float values.
SQL ASIN Function Example 2
In this example, We are going to calculate the Arcsine value for all the records present in [Service Grade] using ASIN Function.
SELECT [EnglishProductName] ,[Color] ,[StandardCost] ,[SalesAmount] ,[Service Grade] AS Grade ,ASIN([Service Grade]) AS [Arc Sine] FROM [Mathemetical Functions]
Thank You for Visiting Our Blog