[dba-SQLServer] Return the result set of a sproc additively

Robert L. Stewart robert at webedb.com
Tue Sep 16 10:03:10 CDT 2008


Use temp tables to hold the data until you can union it.


At 09:43 AM 9/16/2008, you wrote:
>Date: Tue, 16 Sep 2008 11:43:38 -0300
>From: "Arthur Fuller" <fuller.artful at gmail.com>
>Subject: [dba-SQLServer] Return the result set of a sproc additively
>To: "Discussion concerning MS SQL Server"
>         <dba-sqlserver at databaseadvisors.com>
>Message-ID:
>         <29f585dd0809160743v5d74bb86l5c788d05e33ea32e at mail.gmail.com>
>Content-Type: text/plain; charset=ISO-8859-1
>
>I'm having a senior moment, but I know I have done this, and I think I have
>written about how to do it, but I can't find the article and can't remember
>how to do it, but I do know it can be done.
>
>Here's the gist.
>
>I want to call a sproc (which is just a select) N times and have the result
>sets "unioned", as it were. Say for example we have 5 salespersons in a
>company, and I want the sales of 4 of them. It's easy to grab the 4 selected
>IDs, but then I want to go in and grab all the sales for those 4. This is
>the important part: I don't want to rewrite the logic that's already there
>to grab one salesperson's data. I want to call that sproc several times and
>union the results.
>
>I'm sure that I have done this but at the moment I can't remember how I did
>it.
>
>TIA,
>Arthur





More information about the dba-SQLServer mailing list