Code to list dates end of month dates between specific start and end date ranges

  • I appreciate your help on the end of month.

    I am trying but failing at augmenting the code to break down the difference between start and end date by individual days.  Currently, breaks down by month end of each month in respective range. 

    Thank you again.

    -Alex

  • I think i figured it out.  I was only changing the dayadd formula in the select to 'day'.  Just changed the datediff in the cross apply and i think it did it.

    Is it that simple?

  • Caps out at 100 rows where there should be more? this i would def hope to get your input on

    Thank you for your help and for being so patient with me.

  • alexander.lummer - Friday, August 31, 2018 12:31 PM

    Caps out at 100 rows where there should be more? this i would def hope to get your input on

    Thank you for your help and for being so patient with me.

    It sounds like you're still using a recursive CTE to generate dates.  Is that true?  Yeah, there's a fix to get past 100 with recursive CTEs but using a recursive CTE for such a thing is (and there's no other word for it) stupid.  It's a totally unnecessary waste of logical reads, CPU, and duration even for wicked small stuff.

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

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