dbcolutype

Returns the user-defined datatype for a regular result column.

Syntax

DBINT dbcolutype (
PDBPROCESS
dbproc,
INT
column );

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.
column
Is the number of the column. The first column is number 1. For further information, see "dbadata."

Returns

The column parameter's user-defined datatype on success and -1 on error.

Remarks

For a description of how to add user-defined datatypes to SQL Server databases, see the Microsoft SQL Server Transact-SQL Reference.

This function is defined as datatype DBINT to accommodate the size of user-defined datatypes. Both DBINT and user-defined datatypes are 32 bits long. Call dbcolutype after dbresults returns SUCCEED.

Example

This example shows how to use dbcolutype:

DBPROCESS    *dbproc;
int            colnum;
int            numcols;

// Put the command into the command buffer.
dbcmd (dbproc, "select * from mytable");

// Send the command to the SQL Server and begin execution. 
dbsqlexec(dbproc);

// Process the command results. 
dbresults(dbproc);
// Examine the user-defined column types. 
numcols = dbnumcols(dbproc);
for (colnum = 1; colnum < numcols; colnum+)
{
     printf
     ("column %d, user-defined type is %ld.\n",
     colnum, dbcolutype(dbproc, colnum));
}

See Also

dbaltutype, dbcoltype