Islands and Gaps in Sequential Numbers
As you know, relational databases are set-based and aren't particularly suited for row-at-a-time processing. However, in situations with heavily fragmented data (lots of gaps), you may find that row-based processing does better than set-based processing. Alexander Kozak demonstrates.