dbaltcolid

Returns the operand column ID for a compute column.

Syntax

INT dbaltcolid (
PDBPROCESS
dbproc,
INT
computeid,
INT
column );

where

dbproc
Is the DBPROCESS structure that is the handle for a particular workstation/ SQL Server process. It contains all the information that DB-Library uses to manage communications and data between the workstation and SQL Server.
computeid
Is the ID that identifies 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 dbnextrow or dbgetrow.
column
Is the number of the compute column. The first column is number 1.

Returns

The column ID that the aggregate in the compute applies to. The first column is number 1. If either computeid or column is invalid, -1 is returned. Call this function after dbnextrow or dbgetrow returns a computeid.

Example

When issued after the following SELECT statement, dbaltcolid(dbproc, 1, 1) returns 2, because the COMPUTE COUNT clause in the SELECT statement 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

dbadata, dbadlen, dbaltlen, dbgetrow, dbnextrow, dbnumalts, dbprtype