This is a discussion on SP returning a table -- ? within the SQL Server forums, part of the Microsoft SQL Server category; --> There's an SP that in effect returns a table -- it loops and executes statements like SELECT @field1, @Field2, ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| There's an SP that in effect returns a table -- it loops and executes statements like SELECT @field1, @Field2, @Field2 Can I capture its results in a table? I know that if it were a FUNCTION that returned a table, that would be simple: INSERT ResultsTable SELECT * FROM dbo.Function (@Param1, @Param2) But how to do that if the code is a procedure rather than a function? |
| ||||
| Hi Check out the form of insert statement that calls exec INSERT INTO <TABLE> execute_statement i.e INSERT INTO <TABLE> EXEC stored_procedure http://msdn.microsoft.com/library/de...asp?frame=true John "Jim Geissman" <jim_geissman@countrywide.com> wrote in message news:b84bf9dc.0308291355.6af690b6@posting.google.c om... > There's an SP that in effect returns a table -- it loops and executes > statements like SELECT @field1, @Field2, @Field2 > > Can I capture its results in a table? I know that if it were a FUNCTION > that returned a table, that would be simple: > > INSERT ResultsTable SELECT * FROM dbo.Function (@Param1, @Param2) > > But how to do that if the code is a procedure rather than a function? |