Returns the data type for a compute column.
INT dbalttype (
PDBPROCESS dbproc,
INT computeid,
INT column );
dbproc
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
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
The number of the column. The first column is number 1.
The type of the data for the particular column in the compute. The types are defined as follows:
Column data type | Returned constant |
---|---|
Char | SQLCHAR |
Varchar | SQLCHAR |
Binary | SQLBINARY |
Varbinary | SQLBINARY |
Tinyint | SQLINT1 |
Smallint | SQLINT2 |
Int | SQLINT4 |
Real | SQLFLT4 |
Float | SQLFLT8 |
Smallmoney | SQLMONEY4 |
Money | SQLMONEY |
Decimal | SQLDECIMAL |
Numeric | SQLNUMERIC |
Smalldatetime | SQLDATETIM4 |
Datetime | SQLDATETIME |
Image | SQLIMAGE |
Text | SQLTEXT |
Call dbalttype only after dbnextrow or dbgetrow returns a computeid.
If either the computeid or column is invalid, -1 is returned.
In the following SELECT statements, calling dbalttype(dbproc, 1, 1) returns the type for SQLINT4 because counts are of SQLINT4 type.
SELECT dept, name FROM employee
ORDER BY dept, name
COMPUTE COUNT(name) BY dept
To convert the type to a readable string, use dbprtype.