QODBC Numeric Functions The following Numeric Functions can be used in QODBC to obtain various results in your SQL statements:-
ABS(numeric_exp) – Returns the absolute value of numeric_exp.
Example:
SELECT "Name", {fn ABS(Balance)} AS "ABSBalance", "Balance" FROM Customer
Returns:
Name
|
ABSBalance
|
Balance
|
Utility Room
|
1099.95
|
-1099.95
|
Workshop
|
4735.73
|
4735.73
|
Wilks, Daniel
|
0.00
|
0.00
|
ACOS(float_exp) – Returns the arccosine of float_exp as an angle, expressed in radians.
Example:
SELECT {fn ACOS({fn CONVERT(0, SQL_FLOAT)})} AS "ACOSValue" FROM Company
Returns:
ASIN(float_exp) – Returns the arcsine of float_exp as an angle, expressed in radians.
Example:
SELECT {fn ASIN({fn CONVERT(1, SQL_FLOAT)})} AS "ASINValue" FROM Company
Returns:
ATAN(float_exp) – Returns the arctangent of float_exp as an angle, expressed in radians.
Example:
SELECT {fn ATAN({fn CONVERT(1, SQL_FLOAT)})} AS "ATANValue" FROM Company
Returns:
ATAN2(float_exp1, float_exp2) – Returns the arctangent of the x and y coordinates specified by float_exp1 and float_exp2, respectively, as an angle, expressed in radians.
Example:
SELECT {fn ATAN2({fn CONVERT(1, SQL_FLOAT)}, {fn CONVERT(2, SQL_FLOAT)})} AS "ATAN2Value" FROM Company
Returns:
CEILING(numeric_exp) – Returns the smallest integer greater than or equal to numeric_exp.
Example:
SELECT "Name", {fn CEILING("Balance")} AS "CeilingBalance", "Balance" FROM Customer
Returns:
Name
|
CeilingBalance
|
Balance
|
Utility Room
|
-1099.00
|
-1099.95
|
Workshop
|
4736.00
|
4735.73
|
Wilks, Daniel
|
0.00
|
0.00
|
COS(float_exp) – Returns the cosine of float_exp, where float_exp is an angle expressed in radians.
Example:
SELECT {fn COS({fn CONVERT(1, SQL_FLOAT)})} AS "COSValue" FROM Company
Returns:
COT(float_exp) – Returns the cotangent of float_exp, where float_exp is an angle expressed in radians.
Example:
SELECT {fn COT({fn CONVERT(1, SQL_FLOAT)})} AS "COTValue" FROM Company
Returns:
DEGREES(numeric_exp) – Returns the number of degrees converted from numeric_exp radians.
Example:
SELECT {fn DEGREES(1)} AS "DegreesReturned" FROM Company
Returns:
EXP(float_exp) – Returns the exponential value of float_exp.
Example:
SELECT {fn EXP({fn CONVERT(1, SQL_FLOAT)})} AS "ExpReturned" FROM Company
Returns:
FLOOR(numeric_exp) – Returns largest integer less than or equal to numeric_exp.
Example:
SELECT "Name", {fn FLOOR("Balance")} AS "FloorBalance", "Balance" FROM Customer
Returns:
Name
|
FloorBalance
|
Balance
|
Utility Room
|
-1100.00
|
-1099.95
|
Workshop
|
4735.00
|
4735.73
|
Wilks, Daniel
|
0.00
|
0.00
|
LOG(float_exp) – Returns the natural logarithm of float_exp.
Example:
SELECT {fn LOG({fn CONVERT(25, SQL_FLOAT)})} AS "LogReturned" FROM Company
Returns:
LOG10(float_exp) – Returns the base 10 logarithm of float_exp.
Example:
SELECT {fn LOG10({fn CONVERT(25, SQL_FLOAT)})} AS "Log10Returned" FROM Company
Returns:
MOD(integer_exp1, integer_exp2) – Returns the remainder (modulus) of integer_exp1 divided by integer_exp2.
Example:
SELECT {fn MOD(27, 7)} AS "Mod7Returned" FROM Company
Returns:
PI() – Returns the constant value of pi as a floating point value.
Example:
SELECT {fn PI()} AS "PI" FROM COMPANY
Returns:
POWER(numeric_exp, integer_exp) – Returns the value of numeric_exp to the power of integer_exp.
Example:
SELECT {fn POWER(4, 3)} AS "PowerValue" FROM COMPANY
Returns:
RADIANS(numeric_exp) – Returns the number of radians converted from numeric_exp degrees.
Example:
SELECT {fn RADIANS(57.29578)} AS "RadiansValue" FROM COMPANY
Returns:
|