May 1, 2014 at 4:41 pm
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).
May 2, 2014 at 8:16 am
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/
May 2, 2014 at 3:41 pm
I was looking for that. I'll ping him.
May 6, 2014 at 11:26 am
Lynn is going to tackle this.
September 4, 2014 at 7:39 am
A dates table can provide all of those answers, and more.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply