# SQL SERVER – Math Functions for 2005

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

## 5 thoughts on “SQL SERVER – Math Functions for 2005”

1. stan |

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.

2. vivek |

how to use MOD function in sql server 2005 .

I want record like 101 201 301 out of 100000 rows

3. Ronak |

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

4. P Naveen |

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

5. FARHAN SHAIKH |

SQUARE() Float expression

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

SELECT SQUARE(3)
9