SqlAltOp%

Returns the type of aggregate function in a compute column.

Syntax

SqlAltOp% ( sqlconn%, computeid%, column% )

where

sqlconn%
Is a SQL Server connection. The value of sqlconn% is returned by SqlOpen%.
computeid%
Is the COMPUTE clause. A SELECT statement can have multiple COMPUTE clauses, which can have varying numbers of aggregate operators and aggregate targets. The computeid% is returned by SqlNextRow% or SqlGetRow%.
column%
Is the number of the column. The first column returned is number 1.

Returns

The type of aggregate function in a particular column in a COMPUTE clause, as follows:

Aggregate function
type

Aggregate operator
SQLAOPSUM SUM
SQLAOPAVG AVG
SQLAOPCNT COUNT
SQLAOPMIN MIN
SQLAOPMAX MAX

Call SqlAltOp% only after SqlNextRow% or SqlGetRow% returns a computeid. When the computeid% or column% is not valid, -1 is returned.

Remarks

SqlAltOp% returns the type of aggregate function in a particular column in a COMPUTE clause. In the following example, SqlAltOp%(sqlconn%, 1, 1) returns the type for COUNT because the first aggregate operator in the first COMPUTE clause is COUNT:

select dept, name from employee
order by dept, name
compute count(name) by dept

To convert the type to a readable string, use SqlPrType$.

See Also

SqlAData$, SqlADLen&, SqlAltLen%, SqlGetRow%, SqlNextRow%, SqlNumAlts%, SqlPrType$