Returns the SQL Server datatype of a compute column.
SqlAltType% ( sqlconn%, computeid%, column% )
where
The type of data in a column in the COMPUTE clause, as follows:
| Column datatype |
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 SqlAltType% only after SqlNextRow% or SqlGetRow% returns a computeid.
If either the computeid% or the column% is invalid, - 1 is returned.
SqlAltType% returns the datatype in a particular column in a COMPUTE clause. In the following example, SqlAltType%(sqlconn%, 1, 1) returns the type for SQLINT4 because the counts are of sqlint4 datatype.
select dept, name from employee order by dept, name compute count(name) by dept
To convert the type to a readable string, use SqlPrType$.
SqlAData$, SqlADLen&, SqlAltLen%, SqlGetRow%, SqlNextRow%, SqlNumAlts%, SqlPrType$; DB-Library for Visual Basic Options.