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
Latest posts by DuttaluruVijayakumar (see all)
- How to create dynamic form fields using jQuery - January 4, 2021
- What is CTS (Common Type System) in .Net - October 16, 2020
- What is main method in c# - October 13, 2020
I agree with your details , superb post.
Usually posts some extremely exciting stuff like this. If you are new to this site.
Here is a good Blog You may Obtain Fascinating that we encourage you to visit.
One of our visitors recently recommended the following website.
tҺe website іѕ really good, I like your website!