• mschroeppel (7/4/2010)


    I also found this article rather insulting. I almost never use cursors. In fact, I think I should use them more. I sometimes find myself dong mental jujitsu, trying to write set-based T-SQL, when the task lends itself more easily to procedural code.

    Of course they are slower, but sometimes performance is not as important as writing something that is simple and easily maintainable. Arguing that programmers are lazy and dumb is all the more reason to write something in a way that your (lazy, dumb) successors will understand.

    Obviously anyone reading this article is interested in avoiding cursors, so why start off with a self-indulgent rant? JMHO.

    Set-based processing does stretch the old brain cells a bit, but as you point out everyone understands a loop.

    I just had a recent discussion with a group about the benefits of writing extremely simplistic code versus efficiency (and several other programming oddities, btw). I listed out several coding priorities and challenged them to put their coding priorities in the correct order for their business. If you try this exercise and "efficiency" is at the bottom of the list, then you obviously have to code to your priorities.

    Mike C