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

Nick Gorham nick at easysoft.com
Thu Aug 19 23:20:56 BST 2004

Don Oliver wrote:

> 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??

Normally you would execute a statement like (This is the ODBC syntax, so 
drivers can map it to whatever works for them)

{call proc( ?, ?, ? )}

where the ? are the parameter place markers, and you bind them as input, 
output or inout.

if the procedure returns a value, then the syntax is

{?=call func( ?, ?, ? )}

Where the first param is the output param.

However as to if this works in freetds, I don't know.

Nick Gorham
Easysoft Limited

More information about the unixODBC-dev mailing list