In MSSQL, I needed to loop over a bunch of orders and execute a stored procedure, except in one case. This does that:
declare @orderid int; DECLARE @RC int declare ordercursor cursor FOR SELECT id FROM [ORDER]; open ordercursor fetch next FROM ordercursor INTO @orderid while @@fetch_status = 0 begin IF @orderid != 429 begin EXECUTE @RC = [DeleteOrderById] @orderid end fetch next FROM ordercursor INTO @orderid; end close ordercursor; deallocate ordercursor;
Recent Comments