Mathematical Functions (SQL)

Help Contents


Mathematical functions perform a numeric calculation.


primary-function-math ::=
  ABS ( value-expression )
  | ACOS ( value-expression )
  | ASIN ( value-expression )
  | ATAN ( value-expression )
  | ATAN2 ( value-expression, value-expression )
  | CEILING ( value-expression )
  | COS ( value-expression )
  | EXP ( value-expression )
  | FLOOR ( value-expression )
  | LN ( value-expression )
  | LOG ( value-expression )
  | POWER ( value-expression, value-expression )
  | ROUND ( value-expression, value-expression )
  | ROUNDSD ( value-expression, value-expression )
  | SIGN ( value-expression )
  | SIN ( value-expression )
  | SQRT ( value-expression )
  | TAN ( value-expression )


These Mathematical functions are supported:

Abs( X ) Returns the absolute value of X.
Acos( X ) Returns the arc cosine of X in radians.
Asin( X ) Returns the arc sine of X in radians.
Atan( X ) Returns the arc tangent of X in radians.
Atan2( X, Y ) Returns the angle, in radians, between the positive x-axis and a line drawn from the origin to ( x, y ).
Ceiling( X ) Returns the smallest integer value that is greater than or equal to X.
Cos( X ) Returns the cosine of X, where X is measured in radians.
Exp( X ) Returns e raised to the power of X.
Floor( X ) Returns the largest integer value that is less than or equal to X.
Ln( X ) Returns the natural logarithm of X.
Log( X ) Returns the log to base 10 of X.
Power( X, Y ) Returns X raised to the power Y.
Round( X, Y ) Returns X rounded to Y decimal places.
Note: Half way cases are rounded away from zero.
RoundSD( X, Y ) Returns X rounded to Y significant digits.
Note: Half way cases are rounded away from zero.
Sign( X ) Returns +1, 0, or -1, depending on whether X is positive, zero, or negative.
Sin( X ) Returns the sine of X, where X is measured in radians.
Sqrt( X ) Returns the square root of X.
Tan( X ) Returns the tangent of X, where X is measured in radians.


1. Return the analog tag values plus the values rounded down to the nearest integer:

SELECT FullName,Value,FLOOR(Value) "Rounded Value"
FROM TagDataPointAnalog

Further Information

Value Expressions (SQL)

To learn more about SQL scalar value expressions.

Fernhill SCADA Structured Query Language (SQL)

To learn more about the SQL features in Fernhill SCADA.


For the meaning of terms used in Fernhill SCADA.