Results of a procedure into a cursor

  • Can I get a results of a procedure into a cursor?

    For Eg:

    Instead of using Declare test_cursor cursor for Select * from Table1

    Can I use Declare test_cursor cursor for exec testproc

     

  • AFAIK, you cannot do it.

    You can define a temporary table and save the results of your SP there. Then open the cursor by select from the temp table.

  • Thanks for the reply.  That is what I intended to do if I had no solution for this one.

  • Of course if you are going to bounce the records into a temp table then you can add an identify column to your temp table and dispense with the cursor entirely.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply