Nesting Stored Procedures

  • I understand that I can use stored procedures from another stored procedure quite happily and merrily and have done so many times in the last 2 months.

    What I'm really struggling with, though, is how to get a handle on the results from said stored procedure within the calling procedure.

    A stored procedure can return a results table, a scalar value or nothing and VB handles those result sets perfectly well.

    But when I try to use those exact same procedures (and let's face it; isn't that the main point of a stored procedure?) in another stored procedure I find it very, VERY difficult to access any part of the result except the return code.

    So far the only stored procedures I've been able to use really properly are "action only" procedures with NO returned results.

    If I want to see the result of the SP the only option I've found for doing so is to do an insert into a table variable; which has to be defined with every field coming back from the procedure because there's no means to select the fields you want before inserting them. Not only is that an incredible pain in the rear but it's also a huge violation of best practices for any RDBMS because it means you can't add fields to the result table without amending every procedure that calls it.

    Isn't there some way; even if it means adding an intervening object, that will allow me to use the results of a stored procedure just like the results of a SELECT statement the way VB does?

Viewing post 31 (of 30 total)

You must be logged in to reply to this topic. Login to reply