dbrettype

DB Library for C

DB Library for C

dbrettype

Determines the data type of a return-parameter value generated by a stored procedure or a remote stored procedure.

Syntax

INT dbrettype (
PDBPROCESS
dbproc,
INT
retnum );

Arguments

dbproc

Is 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.

retnum

Is the number of the returned value of interest. The first return value is number 1. Values are returned in the same order as the parameters were originally specified in the stored procedure's CREATE PROCEDURE statement. (Note that this is not necessarily the same order as that specified in the remote stored procedure.) When specifying retnum, nonreturn parameters are not counted. For example, if the second parameter in a stored procedure is the only return parameter, its retnum is 1, not 2.

Returns

A token value for the data type of the specified return value.

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

If retnum is out of range, -1 is returned.

Remarks

For more information about stored procedure return parameters, see dbretdata.

The server returns stored procedure information (including any return status and parameter values) immediately after returning all normal results for that stored procedure. Process the normal results, and then call dbrettype after dbresults returns NO_MORE_RPC_RESULTS (for all stored procedures in a batch except the last one) or NO_MORE_RESULTS (for a single stored procedure, or for the last stored procedure in a batch).

The dbrettype function actually returns an integer token value for the data type (SQLCHAR, SQLFLT8, and so on). To convert the token value into a readable token string, use dbprtype. For more information about a list of all token values and their equivalent token strings, see dbprtype.

See Also

dbnextrow

dbretlen

dbnumrets

dbretname

dbprtype

dbrpcinit

dbresults

dbrpcparam

dbretdata

DB-Library for C Data Types