dbaltcolid

DB Library for C

DB Library for C

dbaltcolid

Returns the operand column ID for a compute column.

Syntax

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

Arguments

dbproc

Is the DBPROCESS structure that is the handle for a particular workstation or Microsoft® SQL Server™ 2000 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.

Examples

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

dbnextrow

dbadlen

dbnumalts

dbaltlen

dbprtype

dbgetrow