Exiting WHILE @@ FETCH_STATUS = 0 in db_cursor

Is there any way to exit WHILE @@FETCH_STATUS = 0db_cursor at runtime?

I tried SET @@FETCH_STATUS = 1, but, as I expected, an error occurred. Help?

+5
source share
1 answer

You can use BREAKto exit the while loop.

+21
source

All Articles