SqlColInfo%

Returns information about a regular column or a compute column in a result set, or a column in a cursor.

Syntax

SqlColInfo% ( sqlhandle%, type%, column%, computeid%, columninfo )

where

sqlhandle%
Is a SQL Server connection or a cursor handle. If type% is SQLCI_REGULAR% or SQLCI_ALTERNATE%, this is a SQL Server connection (returned by SqlOpen%). If type% is SQLCI_CURSOR%, this is a cursor handle (returned by SqlCursorOpen%).
type%
Is the type of column information to return. The following table describes the different type% values:
type% Description
SQLCI_REGULAR% Return information about a regular column in the current result set.
SQLCI_ALTERNATE% Returns information about a compute column in the current result set.
SQLCI_CURSOR% Returns information about a column in the open cursor.

column%
The number of the column. The first column is number 1.
computeid%
If type% is SQLCI_ALTERNATE, this is the ID that identifies the compute (the result of a COMPUTE clause) value. The computeid% is returned by SqlNextRow% or SqlGetRow%.
columninfo
A ColInfo structure that DB-Library will use to return detailed information about the specified column.

The ColInfo structure is defined as follows:

Type ColInfo
    Name As String * 31
    ActualName As String * 31
    TableName As String * 31
    CType As Integer
    UserType As Long
    MaxLength As Long
    Precision As Integer
    Scale As Integer
    VarLength As Integer
    Null As Integer
    CaseSensitive As Integer
    Updatable As Integer
    Identity As Integer
End Type

The ColInfo fields (and the equivalent DB-Library functions, if any) are described below:
Field Description
Name Is the name of the returned column (SqlColName$).
ActualName Is the actual name of the column in TableName if type% is SQLCI_CURSOR%; otherwise, this is the same as Name.
TableName Is the table that contains the column if type% is SQLCI_CURSOR%; otherwise, an empty string.
CType Is the datatype of the column (SqlColType%, SqlAltType%).
UserType Is the user-defined datatype of the column (SqlColUType&, SqlAltUType&).
MaxLength Is the maximum length, in bytes, of the column (SqlColLen%, SqlAltLen%).
Precision The precision if Type is SQLDECIMAL or SQLNUMERIC; otherwise, - 1.
Scale The scale if Type is SQLDECIMAL or SQLNUMERIC; otherwise, - 1.
VarLength Is one of the following:

SUCCEED (1) if the column is variable-length.

FAIL (0) if the column is fixed-length.

Null Is one of the following:

SUCCEED (1) if the column allows nulls.

FAIL (0) if the column does not allow nulls.

SQLUNKNOWN (2) if nullability is unknown.

CaseSensitive Is one of the following:

SUCCEED (1) if the column is case sensitive.

FAIL (0) if the column is case insensitive.

SQLUNKNOWN (2) if case sensitivity is unknown.

Updatable Is one of the following:

SUCCEED (1) if the column can be changed.

FAIL (0) if the column is read-only and cannot be changed.

SQLUNKNOWN (2) if updatability is unknown.

Identity Is one of the following:

SUCCEED (1) if the column is an identity column.

FAIL (0) if the column is not an identity column.


Returns

succeed (1) or fail (0).

Remarks

The SqlColInfo% function fills the supplied ColInfo structure with information about the specified column. Call this function after SqlResults% returns SUCCEED, or after SqlCursorOpen% returns a cursor handle.

See Also

SqlAltLen%, SqlAltType%, SqlAltUType&, SqlColLen%, SqlColName$, SqlColType%, SqlColUType&