SQL Server Forums - how to exit from a cursor loop on a specified cond
Here is an example: declare @checkval nvarchar(255) declare test_cursor cursor for select [name] from sys.objects open test_cursor fetch next from test_cursor into @checkval while @@fetch_status = 0 begin print @checkval-- Here comes the conditional exit ...