QUESTION: How can I call a Stored Procedure from another Stored Procedure

QUESTION: How can I call a Stored Procedure from another Stored Procedure

Post by Keith Messin » Thu, 09 Apr 1998 04:00:00



I need to access the results of stored procedure sp_1 inside of stored
procedure sp_2.

sp_1 takes three parameters and returns a result set of data.

Help.  Thanks!

Keith Messing

 
 
 

QUESTION: How can I call a Stored Procedure from another Stored Procedure

Post by Gorantl » Thu, 09 Apr 1998 04:00:00


Use :
    Create Table #temptable (.......)

    Insert Into #temptable
    Execute sp_name

Now you can access the data from the temp table.


> I need to access the results of stored procedure sp_1 inside of stored
> procedure sp_2.

> sp_1 takes three parameters and returns a result set of data.

> Help.  Thanks!

> Keith Messing


 
 
 

QUESTION: How can I call a Stored Procedure from another Stored Procedure

Post by Gert E.R. Draper » Sun, 19 Apr 1998 04:00:00


Instead of passing a temp table name you can insert the resultset into a
temp table in sp2 using the results set of the sp as input for an insert.
This is introduced in 6.5.

INSERT [INTO]
{table_name | view_name} [(column_list)]



 You can also use this with remote stored procedures, so you can return a
result set from a different SQL Server.