RE: Multiple Stored Procedure Execute Together - How?
From: mark baekdal (markbaekdal_at_discussions.microsoft.com)
Date: 02/03/05
- Next message: Louis Davidson: "Re: Multiple Stored Procedure Execute Together - How?"
- Previous message: oj: "Re: Drop Table"
- In reply to: GJ: "Multiple Stored Procedure Execute Together - How?"
- Next in thread: Louis Davidson: "Re: Multiple Stored Procedure Execute Together - How?"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 2 Feb 2005 22:43:01 -0800
Hello GJ.
execute the stored procedures saving the result sets to a temporary table
and then select the results from the temporary table to give you a single
result set
IE:
use Northwind
GO
set nocount on
if object_id('tempdb..#results') is not null drop table #results
create table #results(
index_name sysname,/* Index name. */
index_description varchar(210),/* Index description. */
index_keys nvarchar(2078)/* Table or view column(s) upon which the index is
built. */
)
insert #results(index_name,index_description,index_keys)
exec sp_helpindex @objname = 'dbo.Categories'
insert #results(index_name,index_description,index_keys)
exec sp_helpindex @objname = 'dbo.Customers'
select * from #results
regards,
Mark Baekdal
http://www.dbghost.com
http://www.innovartis.co.uk
+44 (0)208 241 1762
Database change management for SQL Server
"GJ" wrote:
> Hi,
>
> I have multiple stored procedures (SP) running in multiple databases. The
> output of all the databases has same column names, same number of columns and
> column types.
>
> I want to run all these different SP's as one SP and combine the output as
> one result.
>
> I tried creating one new SP as SPAll and calling all the SP's in SPAll.
> eg.
>
> Create SPAll @Parameter int
> AS
> Exec SP1 @Parameter
> Exec SP2 @Parameter
> GO
>
> But when I execute SPAll from 'sql server reporting services' (vs.net), it
> executes and displays results from SP1 also. I want to display results from
> both SP1 and SP2.
>
> Thanks in advance.
- Next message: Louis Davidson: "Re: Multiple Stored Procedure Execute Together - How?"
- Previous message: oj: "Re: Drop Table"
- In reply to: GJ: "Multiple Stored Procedure Execute Together - How?"
- Next in thread: Louis Davidson: "Re: Multiple Stored Procedure Execute Together - How?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|