dbordercol

Returns the ID of a column appearing in the most recently executed query's ORDER BY clause.

Syntax

INT dbordercol (
PDBPROCESS
dbproc,
INT
order );

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.
order
Is the ID that identifies the particular ORDER BY column. The first column named within the ORDER BY clause is number 1.

Returns

The column ID (based on the column's position in the select list) for the column in the specified place in the ORDER BY clause. If the order is invalid, then -1 is returned.

Remarks

Call dbordercol after dbresults has returned SUCCEED.

Example

In this example, dbordercol(dbproc, 1) returns 3 since the first column named in the ORDER BY clause refers to the third column in the SELECT statement:

select dept, name, salary from employee
order by salary, name

See Also

DBNUMORDERS