sql server - Stopping an SQL Cursor with one of two conditions -
i have cursor want stop running based on 1 of 2 conditions.
1 based on data of table, , other based on fetch status.
right cursor ignores both , keeps running.
this part of have:
open demandcur fetch next demandcur @...., @++++ while @index > 0 or @@fetch_status = 0 begin select ...., ++++ from...... --after doing stuff here--- fetch next demandcur @...., @++++ end close demandcur deallocate demandcur
should not and, , not or? if of conditions true, query keep running. , in case @@fetch_status true, until end
Comments
Post a Comment