SIN() Examples in SQL Server

Using SQL Server, you can use the T-SQL SIN() function to return the sine of a number. More specifically, this function returns the trigonometric sine of the specified angle, in radians, and in an approximate numeric, float, expression.

The return data type is float.

You provide the number as an argument when calling the function.

Syntax

The syntax goes like this:

SIN ( float_expression ) 

Where float_expression is an expression of type float or of a type that can be implicitly converted to float.

Example 1 – Basic Usage

Here’s a basic example to demonstrate what SIN() returns for a given value.

SELECT SIN(7) Result;

Result:

+-------------------+
| Result            |
|-------------------|
| 0.656986598718789 |
+-------------------+

Example 2 – Negative Value

Here’s an example using a negative value.

SELECT SIN(-7) Result;

Result:

+--------------------+
| Result             |
|--------------------|
| -0.656986598718789 |
+--------------------+

Example 3 – Expressions

You can use expressions like this:

SELECT SIN(5*2) Result;

Result:

+-------------------+
| Result            |
|-------------------|
| -0.54402111088937 |
+-------------------+

So that would have the same result as doing this:

SELECT SIN(10) Result;

Result:

+-------------------+
| Result            |
|-------------------|
| -0.54402111088937 |
+-------------------+

Example 4 – Using PI

In this example, I get the sine of π (pi). I do this by passing in the PI() function as an argument.

SELECT SIN(PI()) Result;

Result:

+----------------------+
| Result               |
|----------------------|
| 1.22464679914735E-16 |
+----------------------+