Tuesday, 8 May 2012


For Dates in a calendar style report you could use the following to generate the dates.

   with mycte as

   ( select cast('2012-01-01' as datetime) DateValue

        union all

        select DateValue + 1

        from    mycte  

         where   DateValue + 1 < getdate())

   -- select DateValue

   -- from    mycte


select DateValue,

Year(DateValue) as Year,

DATEPART(Quarter ,DateValue) as Quarter,

DATENAME( month,DateValue) as MonthName,

DATEPART(m ,DateValue)  as MonthNo,

day (DateValue) as Day

from    mycte


No comments:

Post a Comment

Keep SSRS (SSRS2016) report manager awake

When running a report for the first time in report manager it takes a while to run, after this initial run reports run fine.  There are a ...