• Steve Jones - SSC Editor (5/1/2014)


    I have seen a few questions about how to get the first, last days of the month, year, etc.

    Can someone write a short consolidated article that shows pre- and post-2012 solutions in a series of quick queries that might handle common asks? Let's include:

    - first day of the month

    - last day of the month

    - first day of next month

    - last day of next month

    - variations for quarters/years

    - last particular day, say Friday.

    - last business day (non Sat/Sun).

    I know is isn't an article but Lynn's blog post covers all of those except the last two. http://www.sqlservercentral.com/blogs/lynnpettis/2009/03/25/some-common-date-routines/[/url]

    I just posted an example of how to get the last particular day. http://www.sqlservercentral.com/Forums/FindPost1567034.aspx

    Maybe Lynn would be a good choice to just turn his blog into a spackle article with a few new additions?

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/