Declare a cursor from a stored procedure result set

Declare a cursor from a stored procedure result set

Post by Dietrich L. Westbrook » Fri, 30 Mar 2001 09:22:11



Hello!

I am trying to store the results returned from a stored procedure so I can
walk through the results one row at a time. Does anyone know how I can do
this? or Is there another way? Thanks.

Dietrich L. Westbrooks

 
 
 

Declare a cursor from a stored procedure result set

Post by BP Margoli » Fri, 30 Mar 2001 10:48:47


Dietrich,

You can put the result set returned from a stored procedure (assumed to be
named spDietrich) into a table (temp or otherwise) via the following
technique:

create table #t ( ... )

insert into #t
exec spDietrich

Obviously, your "create table" has to match the result set returned from the
stored procedure.

--------------------------------------------
BP Margolin
Please reply only to the newsgroups.
When posting, inclusion of SQL (CREATE TABLE ..., INSERT ..., etc.) which
can be cut and pasted into Query Analyzer is appreciated.



> Hello!

> I am trying to store the results returned from a stored procedure so I can
> walk through the results one row at a time. Does anyone know how I can do
> this? or Is there another way? Thanks.

> Dietrich L. Westbrooks



 
 
 

Declare a cursor from a stored procedure result set

Post by Dietrich L. Westbrook » Fri, 30 Mar 2001 14:41:06


Thank you! That works just fine.

Dietrich


> Dietrich,

> You can put the result set returned from a stored procedure (assumed to be
> named spDietrich) into a table (temp or otherwise) via the following
> technique:

> create table #t ( ... )

> insert into #t
> exec spDietrich

> Obviously, your "create table" has to match the result set returned from
the
> stored procedure.

> --------------------------------------------
> BP Margolin
> Please reply only to the newsgroups.
> When posting, inclusion of SQL (CREATE TABLE ..., INSERT ..., etc.) which
> can be cut and pasted into Query Analyzer is appreciated.



> > Hello!

> > I am trying to store the results returned from a stored procedure so I
can
> > walk through the results one row at a time. Does anyone know how I can
do
> > this? or Is there another way? Thanks.

> > Dietrich L. Westbrooks