The large majority of math functions are specific to applications using trigonometry, calculus, and geometry. This are very important and it is very difficult to have all of them together at place.

Math Functions

Absolute value **ABS**

Arc cosine **ACOS**

Arc sine **ASIN**

Arc tangent of n **ATAN**

Arc tangent of n and m **ATN2**

Smallest integer >= value **CEILING**

Cosine **COS**

Hyperbolic cosine **COT**

Exponential value **EXP**

Round down to nearest integer **FLOOR**

Natural logarithm **LOG**

Logarithm, base **10 LOG10**

Modulus (remainder) **USE MODULO (%) OPERATOR**

Power **POWER**

Random number **RAND**

Round **ROUND**

Sign of number **SIGN**

Sine **SIN**

Square root** SQRT**

Tangent **TAN**

Convert number if **NULL ISNULL**

Standard deviation **STDEV**

Variance **VAR**

Reference : **Pinal Dave (****http://blog.SQLAuthority.com****)** , BOL Math Functions

is there a way to do a division and modulo in the same statement? I’d like the result of the division to go into one variable and the remainder into another.

LikeLike

how to use MOD function in sql server 2005 .

I want record like 101 201 301 out of 100000 rows

LikeLike

How to get highest value from 5 local variables in a stored procedure.

Eg:

Declare @var1 as int, @var2 as int, @var3 as int, @var4 as int, @var5 as int

Set @var1=55

Set @var2=70

Set @var3=90

Set @var4=90

Set @var5=25

I need value distinct 90 as it is highest among all variables. I mentioned distinct because it repeats in @var3 and @var4 both.

Thanks

LikeLike

create table temp(col1 integer)

select * from temp

DECLARE @temp TABLE(col1 INTEGER)

DECLARE @r int=55

DECLARE @s int=70

DECLARE @t int=90

DECLARE @q int=70

DECLARE @x int=90

INSERT INTO temp(col1) values(@r)

INSERT INTO temp(col1) values(@s)

INSERT INTO temp(col1) values(@t)

INSERT INTO temp(col1) values(@q)

INSERT INTO temp(col1) values(@x)

SELECT MAX(col1) FROM temp

LikeLike

How to get a quotient of two numbers ? what is the function used to get it ?

LikeLike

SQUARE() Float expression

Square of the given numeric expression. Equivalent of POWER function when raised to 2nd power. Example:

SELECT SQUARE(3)

9

LikeLike

SELECT SQUARE(9);

SELECT POWER(9,2);

It’s So Nice.

LikeLike