 # Numeric functions in SQL Server with examples

in this article, we will discuss numeric functions in SQL server with examples

few important numeric functions in SQL server with examples we will discuss

#### ABS() function in SQL examples

abs() function return absolute value of Given Number

```select ABS(-253.1678) as AbsNumber

--output:253.1678
```
```declare @value float
set @value=-253.1678
select ABS(@value) as AbsNumber

--output:253.1678
```

#### MOD() function in SQL examples

MOD() function we will use to get the remainder from a division

```SELECT MOD(25,7)
FROM tab;

--Out put:4
```
```SELECT DISTINCT(MOD(UnitPrice,SupplierId))
FROM [Product];
```
```SELECT DISTINCT(MOD(UnitPrice,SupplierId))
FROM [Product];
```

#### POWER() function in SQL Examples

Power() function returns the given number Square Root Value

```SELECT POWER(10, 2) as SquareRootValue

--Out Put: 100
```

#### ROUND() Function In SQL

ROUND() function returns the given number rounded to the nth decimal place

```SELECT ROUND(285.415, 2) AS RoundValue;

--Out Put: 285.420

SELECT ROUND(285.415, 2, 1) AS RoundValue;

--Out Put: 285.410
```

#### SIN() Function in SQL

The SIN() function in SQL will return the sine of a number.

```SELECT SIN(3) as SinValue

--Out Put: 0.909297426825682

SELECT SIN(-3) as SinValue

--Out Put: -0.909297426825682
```

#### SQRT() Function in SQL

The SQRT() function in SQL returns the square root of a number.

```select SQRT(16) as SquareRootValue

--Out Put:4

select SQRT(100) as SquareRootValue

--Out Put:10

```

#### FLOOR() Function in SQL

The FLOOR() function in SQL returns the largest integer value that is smaller than or equal to a given number.

```SELECT FLOOR(30.95) AS FloorValue;

--Out Put:30

SELECT FLOOR(-30.95) AS FloorValue;

--Out Put:-31
```

#### EXP() Function In SQL

exp() Function in SQL return e raised to power of given number

```SELECT EXP(200) as ExpValue

--Out Put: 7.22597376812575E+86

SELECT EXP(-30.95) AS ExpValue;

--Out Put: 3.6189766840706E-14
```

Subscribe
Notify of Inline Feedbacks Esteban Bosten
February 18, 2020 6:12 am

I agree with your details , superb post. March 26, 2020 6:32 pm

Usually posts some extremely exciting stuff like this. If you are new to this site. April 19, 2020 6:51 am

Here is a good Blog You may Obtain Fascinating that we encourage you to visit. April 19, 2020 11:48 pm

One of our visitors recently recommended the following website. April 25, 2020 10:15 pm

tҺe website іѕ really good, I like your website!

5
0