in reply to Capturing a value returned from a stored procedure

I think your RETURN should be a SELECT. Then you can fetch from it. In SQL Server, you can have a SELECT clause without a FROM clause to return one row of non-table data. (for the benefit of others, it's like selecting 'FROM duel' in Oracle to get one row of non-table data).

If there are intermediate select statements with no INTO clause, then read the DBD::ODBC docs to see how to get multiple result sets. If you can not rewrite your stored procedure, I believe you could execute something like "SELECT sp_myproc(...)" and then fetch from that.

Replies are listed 'Best First'.
Re^2: Capturing a value returned from a stored procedure
by punkish (Priest) on Dec 21, 2004 at 00:11 UTC
    ;-)

    Yes. in my stored proc

    ..bunch of code.. COMMIT TRAN SELECT @id
    and then in my script
    my @id = $sth->fetchrow_array; return $id[0];
    does the trick. Many thanks.