• John Hick-456673 (4/18/2015)


    spaghettidba (4/18/2015)


    John Hick-456673 (4/17/2015)


    spaghettidba (4/17/2015)


    craig 81366 (4/18/2013)


    John Hick-456673 (4/18/2013)


    I have tested it against large tables (1 billion plus rows) and performance is much better than with dynamic SQL.

    I'm going to be blunt here.

    I find that extremely hard to believe.

    +1

    Dynamic SQL is difficult to beat in this case.

    I would go as far as to say that suggesting this technique is a bad advice.

    You are two years behind the eight-ball, there. But, thank you for playing. 😀

    You might have missed that your article is featuring on the main page of SQL Server Central.

    Still bad advice, even two years later.

    That might be - but after the vicious attacks from the first go-round, I am not feeling particularly merciful. Therefore, I presume that you have never written for SCC. I was informed a few weeks ago that the article was to be republished. I braced myself for another round of flames. Surprisingly, there have been only a couple of you who have had the bad grace to treat this as a first publishing - and that as though I am maliciously guiding people astray.

    I had hoped that this article, as well as myself, could just disappear and be forgotten.

    But, maybe I should embrace triangular joins and cursors - no, wait! NESTED CURSORS with extraneous function calls within! THAT'S MY NEW PARADIGM! RBAR, HERE I COME!

    HEY, EVERYBODY! THIS HOW YOU CAN BRING DOWN A SYSTEM! JUST LISTEN TO ME!

    Really, is this what you want? Someone writes an article in the spirit of trying to help and the community wants to burn him at the stake? Really? OK, I get it. Bye!

    jhick signing out on SQL Sever Central, permanently. I'm done. I used to sign in at least a couple of times a week - but this was the last.

    Thanks for all of your USEFUL AND CONSTRUCTIVE *%$*^*** COMMENTS

    Nah. Don't do that. You'd be cheating a whole lot of people that desperately need help out of your good knowledge and experience.

    And this is nothing. If you really want to see someone get flamed, visit my last article on running totals. You haven't seen flaming until you've seen that little gem and I even had proof in code! Keep writing. Even if it turns out that you're wrong, people learn a fantastic amount from the discussions that follow articles like this one... heh... even if it's "just" learning how to post without flaming or how to grow a really thick skin that will benefit you and those around you in the future. It has certainly helped me in all walks of life. 😛 And, the flaming also helps me anticipate what I need to do on the next article to keep me from getting flamed. That has REALLY helped me sell code and design ideas in real life.

    As it turned out on that article and thanks to my patience with the "ring knockers" that attacked my methods in a seriously ad hominem manner, a REALLY important improvement came out that supported my method making it even better.

    Hang in there. Like "Red Green" says, "We're all in this together and I'm pullin' for ya".

    Shifting gears, I believe that a good fellow and friend of mine is in the process taking me up on the challenge of proof even as I write this. I'm also pretty sure that he's only going to let the code do the talking. Hang around and see what happens.

    As to the larger point, thank you for taking the time to write the article. At the very least, which is still tremendously important, it brings guns to bear on a very common problem. So, please, don't go away. You understand what RBAR means and that makes you a "witch" that people will sometimes attempt to burn at the stake. Put on your asbestos underwear and enjoy the "warmth" and learning even if the lessons aren't what you expected. 😛

    --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)