Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

EXEC STORED PROCEDURE

Status
Not open for further replies.

AndyNova

Technical User
Dec 12, 2001
4
CA
I am trying to call a stored procedure from within another sproc and insert the results into a temp table in the calling program.

Using SQL 2000

Ex: USP_TEST has a temp table that will hold the results from USP_TEST2.

I call USP_TEST2 using EXEC USP_TEST2 @date, passing a date parameter. When I run in query analyser I get the results but no sure how to put them into the temp table in USP_TEST.

Have tried INSERT INTO TEMP_TABLE
(ID, NAME, CHQ_AMT, BILL_AMT)
VALUES
(but this is where I need help, how do I get the values form USP_TEST2 into variables or something so I can put into TEMP_TABLE)

Thanks
 
insert into temp_table (ID, NAME, CHQ_AMT, BILL_AMT)

select ID, NAME, CHQ_AMT, BILL_AMT
from USP_TEST2 ;
S. van Els
SAvanEls@cq-link.sr
 
You can insert the results of a stored procedre in SQL Server in the following manner.

Insert #temp
Exec usp_test2

I recommend that you post SQL Server specific questions in the Microsoft SQL Server forum (forum183) rather than the ANSI SQL forum. SQL Server isn't 100% ANSI compliant and has many extensions not found in other RDMS. Terry L. Broadbent - Salt Lake City, UT
Home of the 2002 Winter Olympics (Feb 8-24)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top