Executing a Stored Procedure in a Stored Procedure and selecting on the result 
Author Message
 Executing a Stored Procedure in a Stored Procedure and selecting on the result
Hi

Is there any way available to select on the result of a sp in another sp?

Example:
Alter Procedure sp_Sp2

As

Select *
From EXEC sp_Sp1

How can I do this?

Ole



Thu, 14 Oct 2004 23:25:22 GMT
 Executing a Stored Procedure in a Stored Procedure and selecting on the result

Ole,

Please ALWAYS post which version of SQL Server you are using.

You can do this via the OPENROWSET or OPENQUERY options of the SELECT
command.

Check out the documentation on OPENROWSET and OPENQUERY in the SQL Server
Books Online.

If you are using SQL Server 2000, it will probably make more sense to
convert the stored procedure to a user-defined function. Documentation on
user-defined functions can be found in the SQL Server 2000 Books Online.

-------------------------------------------
BP Margolin
Please reply only to the newsgroups.
When posting, inclusion of SQL (CREATE TABLE ..., INSERT ..., etc.) which
can be cut and pasted into Query Analyzer is appreciated.



Quote:
> Hi

> Is there any way available to select on the result of a sp in another sp?

> Example:
> Alter Procedure sp_Sp2


> As

> Select *
> From EXEC sp_Sp1

> How can I do this?

> Ole



Fri, 15 Oct 2004 00:43:14 GMT
 Executing a Stored Procedure in a Stored Procedure and selecting on the result
BP

I'm sorry I  didn't post my sql-server version. It is 7.0.

I accomplished this by creating a temporary table, insert the results
from sp into that one, and by this I could manipulate the results.

Thank you for your tip

Ole

Quote:

> Ole,

> Please ALWAYS post which version of SQL Server you are using.

> You can do this via the OPENROWSET or OPENQUERY options of the SELECT
> command.

> Check out the documentation on OPENROWSET and OPENQUERY in the SQL Server
> Books Online.

> If you are using SQL Server 2000, it will probably make more sense to
> convert the stored procedure to a user-defined function. Documentation on
> user-defined functions can be found in the SQL Server 2000 Books Online.

> -------------------------------------------
> BP Margolin
> Please reply only to the newsgroups.
> When posting, inclusion of SQL (CREATE TABLE ..., INSERT ..., etc.) which
> can be cut and pasted into Query Analyzer is appreciated.



> > Hi

> > Is there any way available to select on the result of a sp in another sp?

> > Example:
> > Alter Procedure sp_Sp2


> > As

> > Select *
> > From EXEC sp_Sp1

> > How can I do this?

> > Ole



Sat, 16 Oct 2004 00:14:14 GMT
 
 [ 3 post ] 

 Relevant Pages 

1. using SQL stored procedure results in stored procedure

2. Using Stored Procedure's results in a Stored Procedure

3. executing system stored procedures within a stored procedure

4. Using the result from one stored procedure in a second stored procedure

5. Passing a result set from one stored procedure to another stored procedure

6. Using Results Of Stored Procedure As Input Into Another Stored Procedure

7. Returning a query result from a stored procedure into another stored procedure

8. Retrieving result from a stored procedure called within another stored procedure

9. Executing stored procedure from another stored procedure.

10. return select values in stored procedure to a calling stored procedure

11. Calling a Java Stored Procedure from another Java Stored Stored Procedure

12. execute stored procedure for each record in a result set without cursor


 
Powered by phpBB® Forum Software