Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Select a stored procedure?

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-06-04 : 07:36:37
Bret writes "I have created a stored procedure that uses a complex algorithm to calculate what the team & shift should be given any date/time. I need to create a new stored procedure to update the team/shift in a table every 12 hours and would like to reuse code by executing the stored procedure from within another stored procedrue or select statement, is this possible?

SELECT * FROM [stored_procedure]

The stored procedure will use the GETDATE() if no date/time is supplied...

Thanks for your help!

Bret Hill
DBA/Web App Developer
Ocean Spray Cranberries"

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2003-06-04 : 08:28:12
Create a temp table with the exact structure of the rowset generated by your stored procedure. Then use the INSERT ... EXEC ... syntax to pump the proc's rowset into your temp table.

If you are on SQL2K, you may be able to convert the logic in your proc into a table-valued user-defined function.

Jay White
{0}
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2003-06-04 : 12:19:38
quote:

Bret writes ...



I did like hell..

INSERT INTO myTable(col1, col2, ect*) EXEC mySproc

Number of columns returned from the procedure

Brett

8-)

Edit: and it's 2 t's, not one...

Edited by - x002548 on 06/04/2003 12:20:27
Go to Top of Page
   

- Advertisement -