Home Forums SQL Server 2008 T-SQL (SS2K8) First and Last Day Prior Month as Input Parameters RE: First and Last Day Prior Month as Input Parameters

  • Welsh Corgi (4/16/2014)


    I was thinking get the first day of the previous and current month to exclude the Timestamp and use a less then first day of current month?

    I do not wasn't to miss anything.

    That is absolutely the best and most bullet-proof way to do it even if a column supposedly won't ever have times in it or because it's a DATE column. It will survive changes to the underlying datatypes for the columns, new datatypes, etc, etc, without any code changes.

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