Quantcast
Channel: www.oaktable.net - SQL Server
Viewing all articles
Browse latest Browse all 97

Dates in A Range

$
0
0

Fourteen years ago I wrote a short piece on Returning the Days in a Month that has consistently been one of my most popular bits of content. Anton Zlygostev helped update that piece in 2010 by providing a more elegant solution than my original. Now I return to that problem thanks to an interesting question from reader Arturo Ramirez.

Posing the Question

Arturo was after a solution encompassing more than a single month. Following is the question he put to me:

"What if you had two different ranges?

   beg_date        end_date
   01-Jan-2013     15-Jan-2013
   15-Mar-2013     02-Apr-2013

How do you generate individual rows for each day between 01/01 to 01/15, and between 03/15 to 04/02?"

read more


Viewing all articles
Browse latest Browse all 97

Trending Articles