Skip Navigation Links
Home
Articles
SQL Server 2012
SQL Server 2014
SQL Server 2016
FAQ
Forums
Practice Test
Bookstore
Tip of the Day : Example Uses of the CHARINDEX Function
Built-in Functions
Home > Functions > SQL Server Mathematical Functions
SQL Server Mathematical Functions

The following scalar math functions perform a calculation, usually based on input values that are provided as arguments, and return a numeric value.  All mathematical functions, except for RAND, are deterministic functions.  This means they return the same results each time they are called with a specific set of input values.  The RAND function is only deterministic when a seed parameter is specified.

Arithmetic functions, such as ABS, CEILING, DEGREES, FLOOR, POWER, RADIANS, and SIGN, return a value having the same data type as the input value.  Trigonometric and other functions, including EXP, LOG, LOG10, SQUARE, and SQRT, cast their input values to float and return a float value.

Function Description
ABS A mathematical function that returns the absolute (positive) value of the specified numeric expression.

Syntax:

ABS ( numeric_expression )
ACOS A mathematical function that returns the angle, in radians, whose cosine is the specified float expression; also called arccosine.

Syntax:

ACOS ( float_expression )
ASIN Returns the angle, in radians, whose sine is the specified float expression. This is also called arcsine.

Syntax:

ASIN ( float_expression )
ATAN Returns the angle in radians whose tangent is a specified float expression. This is also called arctangent.

Syntax:

ATAN ( float_expression )
ATN2 Returns the angle, in radians, between the positive x-axis and the ray from the origin to the point (y, x), where x and y are the values of the two specified float expressions.

Syntax:

ATN2 ( float_expression, float_expression )
CEILING Returns the smallest integer greater than, or equal to, the specified numeric expression.

Syntax:

CEILING ( numeric_expression )
COS Is a mathematical function that returns the trigonometric cosine of the specified angle, in radians, in the specified expression.

Syntax:

COS ( float_expression )
COT A mathematical function that returns the trigonometric cotangent of the specified angle, in radians, in the specified float expression.

Syntax:

COT ( float_expression )
DEGREES Returns the corresponding angle in degrees for an angle specified in radians.

Syntax:

DEGREES ( numeric_expression )
EXP Returns the exponential value of the specified float expression.

Syntax:

EXP ( float_expression )
FLOOR Returns the largest integer less than or equal to the specified numeric expression.

Syntax:

FLOOR ( numeric_expression )
LOG Returns the natural logarithm of the specified float expression.

Syntax:

LOG ( float_expression )

Function Description
LOG10 Returns the base-10 logarithm of the specified float expression.

Syntax:

LOG10 ( float_expression )
PI Returns the constant value of PI.

Syntax:

PI ()
POWER Returns the value of the specified expression to the specified power.

Syntax:

POWER ( float_expression, y )
RADIANS Returns radians when a numeric expression, in degrees, is entered.

Syntax:

RADIANS ( numeric_expression )
RAND Returns a pseudo-random float value from 0 through 1, exclusive.

Syntax:

RAND ( [ seed ] )
ROUND Returns a numeric value, rounded to the specified length or precision.

Syntax:

ROUND ( numeric_expression, length [ , function ] )
SIGN Returns the positive (+1), zero (0), or negative (-1) sign of the specified expression.

Syntax:

SIGN ( numeric_expression )
SIN Returns the trigonometric sine of the specified angle, in radians, and in an approximate numeric, float, expression.

Syntax:

SIN ( float_expression )
SQRT Returns the square root of the specified float value.

Syntax:

SQRT ( float_expression )
SQUARE Returns the square of the specified float value.

Syntax:

SQUARE ( float_expression )
TAN Returns the tangent of the input expression.

Syntax:

TAN ( float_expression )

Related Articles :