Declare CURSOR on stored procedure result set

Declare CURSOR on stored procedure result set

Post by Mike W » Sat, 15 Feb 2003 01:45:25



Is it possible to declare a cursor for the result set of a
stored procedure call?

I  have experimented with :

and


    exec db.dbo.sp_xxx

But fails the syntax check

 
 
 

Declare CURSOR on stored procedure result set

Post by Paul » Sat, 15 Feb 2003 01:54:51


Mike,

Yes it is. Something roughly along the lines of

EXECUTE ('DECLARE ThisCursor SCROLL KEYSET FOR EXEC db.dbo.sp_xxx')

Not sure if this method can return a cursorvar, you may have to use
sp_executesql in order to return the cursorvar (not sure if that is
allowed, tho).

P


> Is it possible to declare a cursor for the result set of a
> stored procedure call?

> I  have experimented with :

> and


>     exec db.dbo.sp_xxx

> But fails the syntax check