[AccessD] Stored Procedure return value

Arthur Fuller fuller.artful at gmail.com
Fri Jan 23 12:11:38 CST 2009


JC, try this. Declare an OUTPUT parameter in your stored procedure, along
the lines of:

PROC MyProc (@rowcount int OUTPUT)

Inside your proc, you would do a COUNT(*) to obtain said number. In your
other code (non-SQL) you would declare a variable intRowCount or something,
set its value to zero, and pass it into the procedure call. Upon exit from
the procedure, the intRowCount value will contain the number you desire.
This is all similar to ByVal vs. ByRef, but over in the SQL world they use
the term OUTPUT to identify a param that can be directly affected and
returned to the caller.

hth,
Arthur

On Fri, Jan 23, 2009 at 12:52 PM, jwcolby <jwcolby at colbyconsulting.com>wrote:

> I have a stored procedure that builds up a SQL statement
> that performs a bulk insert, then executes that sql statement.
>
> I need to return the number of rows affected.  I assume I
> have to do something inside of the stored procedure but I
> have no idea what.
>
> Does anyone know how to return the rows affected from a SP?
>



More information about the AccessD mailing list