Link to home
Start Free TrialLog in
Avatar of Arora
Arora

asked on

Dynamic Cursor


How do I create dyanamic cursors in Sql Server.

I created oracle procedure and I used

TYPE RCR_GENERAL IS REF CURSOR;
    Rcr_Gp RCR_GENERAL;

I am looking for replacement to above piece.

Thanks,
Arora
Avatar of rafrancisco
rafrancisco

DECLARE rcr_General CURSOR DYNAMIC FOR
   <<SELECT Clause>>


Here's a definition of Dynamic Cursors from Books Online
DYNAMIC Cursors

Defines a cursor that reflects all data changes made to the rows in its result set as you scroll around the cursor. The data values, order, and membership of the rows can change on each fetch. The ABSOLUTE fetch option is not supported with dynamic cursors.
Avatar of Scott Pletcher
Look at:

DECLARE @cursor_variable_name CURSOR

in Books Online (topic "DECLARE").  That may not be exact, but I think that's as close as SQL gets.
Avatar of Arora

ASKER


I am looking something like

Open a cursor for table1 and close
Open a same cursor for table2

If it is not possible, please let me know any alternatives.
ASKER CERTIFIED SOLUTION
Avatar of Scott Pletcher
Scott Pletcher
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial