Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Consolidated Dates Queries Expand / Collapse
Author
Message
Posted Thursday, May 1, 2014 4:41 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Today @ 8:46 AM
Points: 33,200, Visits: 15,343
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).







Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1566872
Posted Friday, May 2, 2014 8:16 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 10:47 AM
Points: 13,302, Visits: 12,165
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/

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 Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1567049
Posted Friday, May 2, 2014 3:41 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Today @ 8:46 AM
Points: 33,200, Visits: 15,343
I was looking for that. I'll ping him.






Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1567190
Posted Tuesday, May 6, 2014 11:26 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Today @ 8:46 AM
Points: 33,200, Visits: 15,343
Lynn is going to tackle this.






Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1568113
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse