[unixODBC-dev] Getting "Return Values" from Stored Procedures

Don Oliver doliver at nxtv.com
Thu Aug 19 22:40:49 BST 2004

Hi all,

I am a newbie.

Using unixODBC 2.2.2 with freetds-0.61 to access a MS-SQL database.

I have successfully used many of the SQL functions to Open connections,
get Record Sets, read rows, columns, etc. All very cool.

The only problem is that I cannot figure out how to read the "Return Value"
provided by Stored Procedures. If the Stored Procedure returns a Record Set, I
can read the rows fine, but if it returns a "Return Value"??

I am porting some code from ASP/JavaScript/ADO, and I see them using Command
objects which use code like :

param = commandObj.CreateParameter("RV", adInteger, adParamReturnValue);

Is there an equivalent parameter type in the ODBC specification??

I haven't found any references to this in any on-line documentation, but there
is a clue in my "sqlext.h" file :

/* Defines for SQLBindParameter and
                           SQLProcedureColumns (returned in the result set) */
#define SQL_PARAM_TYPE_UNKNOWN           0
#define SQL_PARAM_INPUT                  1
#define SQL_PARAM_INPUT_OUTPUT           2
#define SQL_RESULT_COL                   3
#define SQL_PARAM_OUTPUT                 4
#define SQL_RETURN_VALUE                 5

I tried binding a parameter using the SQL_RETURN_VALUE, but I still can't get it
to return a value.

Any clues for the newbie??


More information about the unixODBC-dev mailing list