Forum : What Numeric Functions can be used in QODBC?Search Forum

Forum Home > QODBC - ODBC Driver for QuickBooks > QODBC SQL Sample Scripts Forum

 New Topic 
 
 Post Reply 
[1]  
 What Numeric Functions can be used in QODBC? 
 Author   Message 
  Cary 
  
 Group: Members 
 Posts: 1 
 Joined: 2006-04-21 
 Profile
 Posted : 2006-04-21 09:24:17

I am particularly interested in the format function. Also, if it is easy, I would love to see all the supported functions in one place?

 

  Top 
  Tom Aczel 
  dd4bf_dawworld.jpg
 Group: Administrator 
 Posts: 6281 
 Joined: 2006-02-17 
 Profile
 Posted : 2006-04-21 09:51:55

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:

ACOSValue

1.570796

 

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:

ASINValue

1.570796

 

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:

ATANValue

0.785398

 

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:

ATAN2Value

0.463648

 

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:

COSValue

0.540302

 

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:

COTValue

0.642093

 

DEGREES(numeric_exp) – Returns the number of degrees converted from numeric_exp radians.

Example:

SELECT {fn DEGREES(1)} AS "DegreesReturned" FROM Company

Returns:

DegreesReturned

57.29578

 

EXP(float_exp) – Returns the exponential value of float_exp.

Example:

SELECT {fn EXP({fn CONVERT(1, SQL_FLOAT)})} AS "ExpReturned" FROM Company

Returns:

ExpReturned

2.718282

 

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:

LogReturned

3.218876

 

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:

Log10Returned

1.39794

 

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:

Mod7Returned

6

 

PI() – Returns the constant value of pi as a floating point value.

Example:

SELECT {fn PI()} AS "PI" FROM COMPANY

Returns:

PI

3.141593

 

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:

PowerValue

64

 

RADIANS(numeric_exp) – Returns the number of radians converted from numeric_exp degrees.

Example:

SELECT {fn RADIANS(57.29578)} AS "RadiansValue" FROM COMPANY

Returns:

RadiansValue

1

 

  Top 
  Tom Aczel 
  dd4bf_dawworld.jpg
 Group: Administrator 
 Posts: 6281 
 Joined: 2006-02-17 
 Profile
 Posted : 2006-04-21 09:53:57

RAND([integer_exp]) – Returns a random floating point value using integer_exp as optional seed value.

Example:

SELECT {fn RAND()} AS "RandValue" FROM COMPANY

Returns:

RandValue

0.895865

 

ROUND(numeric_exp, integer_exp) – Returns numeric_exp rounded to integer_exp places right of the decimal point. If integer_exp is negative, numeric_exp is rounded to |integer_exp| places to the left of the decimal point.

Example:

SELECT "Name", {fn ROUND(Balance, 1)} AS "RoundBalance", "Balance" FROM Customer

Returns:

Name

RoundBalance

Balance

Utility Room

-1099.90

-1099.95

Workshop

4735.70

4735.73

Wilks, Daniel

.00

0.00

 

SIGN(numeric_exp) – Returns an indicator or the sign of numeric_exp. If numeric_exp is less than zero, -1 is returned. If numeric_exp equals zero, 0 is returned. If numeric_exp is greater than zero, 1 is returned.

Example:

SELECT "Name", {fn SIGN(Balance)} AS "SignOfBalance", "Balance" FROM Customer

Returns:

Name

SignOfBalance

Balance

Utility Room

-1

-1099.95

Workshop

1

4735.73

Wilks, Daniel

1

0.00

 

SIN(float_exp) – Returns the sine of float_exp, where float_exp is an angle  expressed in radians.

Example:

SELECT {fn SIN({fn CONVERT(1, SQL_FLOAT)})} AS "SINValue" FROM Company

Returns:

SINValue

0.841471

 

SQRT(float_exp) – Returns the square root of float_exp.

Example:

SELECT {fn SQRT({fn CONVERT(47, SQL_FLOAT)})} AS "SQRTValue" FROM Company

Returns:

SQRTValue

6.855655

 

TAN(float_exp) – Returns the tangent of float_exp, where float_exp is an angle  expressed in radians.

Example:

SELECT {fn TAN({fn CONVERT(1, SQL_FLOAT)})} AS "TANValue" FROM Company

Returns:

TANValue

1.557408

 

TRUNCATE(numeric_exp, integer_exp) – Returns numeric_exp truncated to integer_exp places right of the decimal point. If integer_exp is negative, numeric_exp is truncated to |integer_exp| places to the left of the decimal point.

Example:

SELECT "Name", {fn TRUNCATE(Balance, 1)} AS "TruncateBalance", "Balance" FROM Customer

Returns:

Name

TruncateBalance

Balance

Utility Room

-1099.90

-1099.95

Workshop

4735.70

4735.73

Wilks, Daniel

.00

0.00


QODBC Convert

CONVERT(value_exp, data_type) - The function returns the value specified by value_exp converted to the specified data_type, where data_type is one of the following keywords:

SQL_BIGINT, SQL_BINARY, SQL_BIT, SQL_CHAR, SQL_DATE, SQL_DECIMAL, SQL_DOUBLE, SQL_FLOAT, SQL_INTEGER, SQL_LONGVARBINARY, SQL_LONGVARCHAR, SQL_NUMERIC, SQL_REAL, SQL_SMALLINT, SQL_TIME, SQL_TIMESTAMP, SQL_TINYINT, SQL_TYPE_DATE, SQL_TYPE_TIME, SQL_TYPE_TIMESTAMP, SQL_VARBINARY, SQL_VARCHAR

Example:

SELECT ('0'+ {fn CONVERT(Id, SQL_VARCHAR)}) AS "IDString" From Company

Returns:

IDString

01


For more functions
click here
.

 

  Top 
 New Topic 
 
 Post Reply 
[1]  

Jump to