SqlRetType%

Determines the datatype of a return parameter value generated by a stored procedure or a remote stored procedure.

Syntax

SqlRetType% ( sqlconn%, retnum% )

where

sqlconn%
Is a SQL Server connection. The value of sqlconn% is returned by SqlOpen%.
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%, non-return 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 datatype of the specified return value, as shown here:

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

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

Remarks

For more information about stored procedure return parameters, see "SqlRetData$."

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 SqlRetType% after SqlResults% returns NOMORERPCRESULTS (for all stored procedures in a batch except the last one) or NOMORERESULTS (for a single stored procedure, or for the last stored procedure in a batch).

The SqlRetType% function actually returns an integer token value for the datatype (SQLCHAR, SQLFLT8, and so on). To convert the token value into a readable token string, use SqlPrType$. For a list of all token values and their equivalent token strings, see SQLPrType$.

See Also

SqlNextRow%, SqlNumRets%, SqlPrType$, SqlResults%, SqlRetData$, SqlRetLen&, SqlRetName$