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.
| Author |
Topic |
|
ASP_DRUG_DEALER
Yak Posting Veteran
61 Posts |
Posted - 2004-06-30 : 09:42:19
|
| Hey all-I've got a stored procedure that returns a recordset and would like to use that set in another stored procedure. I know you can call a stored procedure from another, but what about working with that data from the called one?CREATE PROCEDURE AS EXEC spMYBIGDATASET--I DONT KNOW HOW TO DO ANYTHING AFTER THIS WITH THE DATA OR EVEN IF I CAN--CAN I PUT IT IN A TABLE VARIABLE? |
|
|
mwjdavidson
Aged Yak Warrior
735 Posts |
Posted - 2004-06-30 : 10:01:00
|
| HiThe easiest way is as follows:CREATE TABLE #tmp (Field1 INT, Field2 INT, etc)INSERT INTO #tmp EXEC spMYBIGDATASETObviously, your temp table's schema must match that of the resultset produced by your stored proc.Unfortunately, an execute statement cannot be used as the source when inserting into a table variable.Mark |
 |
|
|
|
|
|