There Must Be 15 Ways To Lose Your Cursors... part 1, Introduction

  • I agree - don't awaken the beast.

    In the eyes of developers, cursors are like Marmite.

  • ZZZZZZZZZZZZZZZZZZZZZZ ... mmha grmmah mrmma ... ZZZZZZZZZZZZZZZZZZZZ

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • 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.

  • 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

  • RBarryYoung - Monday, April 13, 2009 10:26 PM

    Comments posted to this topic are about the item There Must Be 15 Ways To Lose Your Cursors... part 1, Introduction

    I need quary for show customer I'd, capitalized first and last names, day and month (DD-MON) of date of birth and change the alias name DOB of female customers

  • jadhavdileep2008 - Wednesday, January 9, 2019 7:04 AM

    RBarryYoung - Monday, April 13, 2009 10:26 PM

    Comments posted to this topic are about the item There Must Be 15 Ways To Lose Your Cursors... part 1, Introduction

    I need quary for show customer I'd, capitalized first and last names, day and month (DD-MON) of date of birth and change the alias name DOB of female customers

    You should start a new thread.  People will pay more attention to it and you won't be diluting someone else's discussion.  Since you're brand new to this forum, consider studying the article at the first link under "Helpful Links" in my signature line below.  I'd also recommend you be prepared to demonstrate what you're tried because it's not our job to help you make a living by writing code for you. 😉

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 6 posts - 376 through 380 (of 380 total)

You must be logged in to reply to this topic. Login to reply