LEAP and LAG behind the scenes

  • Jeff Moden (12/24/2015)


    Well, done, Jason! I learned something new today! :w00t: You should write an article on this.

    As always, your kind words are very much appreciated. 🙂

    As far as writing an article... I hadn't really considered it, but I like the idea. Perhaps once I get over this little hurdle... The Most Common Query Blunders...

    Come to think of it, I had planned to write an article about creating an insanely fast "Working Days" iTVF I built a few months back...

  • Jason A. Long (12/25/2015)


    Come to think of it, I had planned to write an article about creating an insanely fast "Working Days" iTVF I built a few months back...

    Now THAT I'd like to see. If you want, I'd be happy to put a second set of eyes on such an article if you want a technical proof reader/code peer review.

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

  • Jeff Moden (12/25/2015)


    Jason A. Long (12/25/2015)


    Come to think of it, I had planned to write an article about creating an insanely fast "Working Days" iTVF I built a few months back...

    Now THAT I'd like to see. If you want, I'd be happy to put a second set of eyes on such an article if you want a technical proof reader/code peer review.

    Thank you! I'll absolutely take you up on that. I've seen the brutality inflicted on those who publish poorly written articles...

  • Jason A. Long (12/25/2015)


    Jeff Moden (12/25/2015)


    Jason A. Long (12/25/2015)


    Come to think of it, I had planned to write an article about creating an insanely fast "Working Days" iTVF I built a few months back...

    Now THAT I'd like to see. If you want, I'd be happy to put a second set of eyes on such an article if you want a technical proof reader/code peer review.

    Thank you! I'll absolutely take you up on that. I've seen the brutality inflicted on those who publish poorly written articles...

    Not to discourage, but I've personally been the brunt of such brutality even when I published well written articles. Oddly enough, it's been at the hands of people who blindly subscribe to certain "best practices". 😀

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

  • Jeff Moden (12/25/2015)


    Jason A. Long (12/25/2015)


    Jeff Moden (12/25/2015)


    Jason A. Long (12/25/2015)


    Come to think of it, I had planned to write an article about creating an insanely fast "Working Days" iTVF I built a few months back...

    Now THAT I'd like to see. If you want, I'd be happy to put a second set of eyes on such an article if you want a technical proof reader/code peer review.

    Thank you! I'll absolutely take you up on that. I've seen the brutality inflicted on those who publish poorly written articles...

    Not to discourage, but I've personally been the brunt of such brutality even when I published well written articles. Oddly enough, it's been at the hands of people who blindly subscribe to certain "best practices". 😀

    I think that raises 2 important ideas...

    1) Being aware that there IS a best practice.

    2) Following it blindly...

    I think there's a huge difference between fumbling until you "get it to work", and making an educated decision, based on specific circumstance, to take a different path.

    Some of your "Dark Arts Kung Fu" may not standard SQL "best practices"... But... They are all based on a deep understanding of how SQL works combined with one hell of an imagination. As people come to understand what you're doing, they tend to become the new best practice... At least on this forum...

  • Refer below post:

    Lead and Lag functions in SQL Server

  • sandeepmittal11 (12/26/2015)


    Refer below post:

    Lead and Lag functions in SQL Server

    Not bad, Sandeep. Just a couple of comments...

    It would be helpful if you added a bit more narrative to explain. For example, an explanation of the output and all the arrows you took time to draw would really help your readers.

    It would be even better if you had a substantial performance test to go with it. After all, performance is second only to accuracy. A comparison to PRECEDING would really take it over the top.

    Please see the following articles on how to make lots and lots of random constrained data.

    http://www.sqlservercentral.com/articles/Data+Generation/87901/

    http://www.sqlservercentral.com/articles/Test+Data/88964/

    --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 7 posts - 16 through 21 (of 21 total)

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