SqlAltColId%

Returns the ID of a compute column.

Syntax

SqlAltColId% ( 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 compute column. The first column returned is number 1.

Returns

The ID that the aggregate operator in the COMPUTE clause column applies to. The first column is number 1. When either the computeid% or the column% is invalid, -1 is returned. Call this function after SqlNextRow% or SqlGetRow% returns a computeid.

Remarks

SqlAltColId% returns the ID of the column to which the aggregate operator applies for a particular column in a COMPUTE clause. For example, the function SqlAltColId%(sqlconn%, 1, 1) returns 2, since the COMPUTE COUNT clause in the following example refers to the second column in the select list:

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

See Also

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