September 11, 2006 at 7:21 am
Hey all,
I just want to know that is there any way to have a table created with the output of a stored procedure?
--Ramesh
September 11, 2006 at 7:56 am
Do you want the output of an SP to populate a table? If so why can't you populate a table as part of sp and query the table when sp is completed.
Or have you looked at insert into tableName...exec sp.
Hope this gives you some idea.
Thanks
Sreejith
September 11, 2006 at 8:41 am
Hi Ramesh,
The answer is, no. You have to create the table first and then populate it like so:
insert
into my_table ([column list]) exec my_procedure
Hope that helps,
September 11, 2006 at 9:07 am
Well you don't absolutely have to but I'd suggest that solution to extreme problems only.
Are you able to create the table before running the SP??
If not then why not??
September 12, 2006 at 12:24 am
Let me give some more information about the thread...
Currently, we're having an SP which gives us paged data by dynamically building the SQL. This SP takes table name , column list, page size , page number etc. as input parameters & according builds the SQL & returns the paged data.
I want to modify this SP to work on the resultset of a stored procedure. This is because, we want to use this SP in all the pages for listing....
Currenly we've done the paging in the page itself. Now we want it to be done in the RDBMS itself.
As explained, in this scenario , we'd never know what the output of a stored procedure & thats why we cannot create a predefined table to populate data.
If this is not possible then what are the alternatives to achieve this task?
--Ramesh
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply