Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««1234

Nesting Stored Procedures Expand / Collapse
Author
Message
Posted Thursday, June 12, 2008 3:02 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Friday, September 19, 2008 2:59 PM
Points: 41, Visits: 41
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?
Post #516287
« Prev Topic | Next Topic »

Add to briefcase «««1234

Permissions Expand / Collapse