Reputation: 527
I'm using a cursor to iterate through dynamic SQL query result set. I'm fully aware that both cursors and dynamic SQL are dubious methods which best be avoided. Please do not address this topics.
I'm fetching entire row in each iteration (and not several columns into corresponding variables). Why? because later on I need to address a dynamically changing column names. But again - that is not the matter on hand.
Is there a way to query the current row? I have failed to do so, so far. For example, this pseudo-code "supposed" to do the job (return the ABCD
column value for the current row).
SELECT [ABCD] FROM Rows_CURSOR
I would appreciate any useful suggestions [just saying "do not use cursors" is not a useful comment ;) ].
Thank you in advance.
Upvotes: 2
Views: 1765
Reputation: 51494
No.
You can update
or delete
the current row of the cursor using where current of
, but you can't select
Upvotes: 1