In a given Date Range I would like to get Name of the Month and End Date of the month. Based on the given values, I will different counts and calculate the final value.
I can do it with CTE, But I dont have idea in how to it completely with CTE.
I prefer one more way than doing it using CTE.
Version of SQL 2008 R2, 2012.
I want the result for the complete date range I provide. Not for one single month
Example : Input which I provide is a date Range
Declare @Start datetime
Declare @End datetime
Select @Start = '2014-08-08'
Select @End = '2015-04-01'
Output required :
Month End Date
August 2014-08-31 00:00:00.000
September 2014-09-30 00:00:00.000
October 2014-10-31 00:00:00.000
November 2014-11-30 00:00:00.000
December 2014-12-31 00:00:00.000
January 2015-01-31 00:00:00.000
February 2015-02-28 00:00:00.000
March 2015-03-31 00:00:00.000