I am working with cursors and successfully executed in T-SQL and the database I use is Microsoft SQL Server 2005.
My query is after I execute the cursor, the output is shown in message area. When I deallocate the cursor using deallocate <cursor name>
it gets deallocated. Again I execute my cursor. Now in the message area I get this:
"Command(s) successfully completed "
and I am not getting the output of the cursor. To resolve, I copied the cursor code and opened a new query area and pasted there. It works perfect for the first time. When I rerun the cursor, the same message is displayed in the message area.
How do I re-execute the same cursor code in the same window rather than creating a new SQL window?