I am using a cursor.
DECLARE @column1 NVARCHAR(MAX); DECLARE cursor_name CURSOR FOR SELECT c1 FROM table_name; OPEN cursor_name; FETCH cursor_name INTO @column1; WHILE @@FETCH_STATUS = 0 BEGIN FETCH cursor_name INTO @column1; END CLOSE cursor_name; DEALLOCATE cursor_name;
Now my question is: can I change the definition of cursor cursor_name after using it? I mean something similar to:
DECLARE cursor_name CURSOR FOR SELECT c2 FROM table_name2;
Using the same cursor name cursor_name , but the protection will be changed. If possible, how to do it?
Thanks.
sql-server tsql cursor
Ogrish man
source share