Home All Groups Group Topic Archive Search About

How to insert resultset from SP into a table? or use Select * From

Author
16 Mar 2006 7:40 PM
Rich
I tried this (and other variations) in Query Analyzer - which did not work.

select * from (exec stp_Report_MonthlyCountHistory_Summary '24', '%',
'3/13/06', '3/13/06')

Is there a way to Select/insert the resultset from an SP?  How to do this?

Thanks,
Rich

Author
16 Mar 2006 7:46 PM
Alejandro Mesa
Rich,

Create a temporary or permanent table with the same structure as the result
of the sp. Use:

insert into #t1
exec dbo.usp_p1 ...


AMB

Show quote
"Rich" wrote:

> I tried this (and other variations) in Query Analyzer - which did not work.
>
> select * from (exec stp_Report_MonthlyCountHistory_Summary '24', '%',
> '3/13/06', '3/13/06')
>
> Is there a way to Select/insert the resultset from an SP?  How to do this?
>
> Thanks,
> Rich
>
Author
16 Mar 2006 9:11 PM
Rich
Thank you.  Yes, I did see that this is the only way to do it.  My objective
is that an SP which I did not create and don't want to modify returns a
dataset that I need to order.  So I want to read/write that data into a temp
table so that I can order it.

Show quote
"Alejandro Mesa" wrote:

> Rich,
>
> Create a temporary or permanent table with the same structure as the result
> of the sp. Use:
>
> insert into #t1
> exec dbo.usp_p1 ...
>
>
> AMB
>
> "Rich" wrote:
>
> > I tried this (and other variations) in Query Analyzer - which did not work.
> >
> > select * from (exec stp_Report_MonthlyCountHistory_Summary '24', '%',
> > '3/13/06', '3/13/06')
> >
> > Is there a way to Select/insert the resultset from an SP?  How to do this?
> >
> > Thanks,
> > Rich
> >
Author
16 Mar 2006 11:10 PM
Alejandro Mesa
Rich,

If you can order the resultset at the client side, then do it and you will
be liberating some load from your sql server.


AMB

Show quote
"Rich" wrote:

> Thank you.  Yes, I did see that this is the only way to do it.  My objective
> is that an SP which I did not create and don't want to modify returns a
> dataset that I need to order.  So I want to read/write that data into a temp
> table so that I can order it.
>
> "Alejandro Mesa" wrote:
>
> > Rich,
> >
> > Create a temporary or permanent table with the same structure as the result
> > of the sp. Use:
> >
> > insert into #t1
> > exec dbo.usp_p1 ...
> >
> >
> > AMB
> >
> > "Rich" wrote:
> >
> > > I tried this (and other variations) in Query Analyzer - which did not work.
> > >
> > > select * from (exec stp_Report_MonthlyCountHistory_Summary '24', '%',
> > > '3/13/06', '3/13/06')
> > >
> > > Is there a way to Select/insert the resultset from an SP?  How to do this?
> > >
> > > Thanks,
> > > Rich
> > >

AddThis Social Bookmark Button