populating a calendar table Newbie question

Hello evryone first post of many ........probably.  Happy new year to you all!

Ok down to business...........

i am in the process of creating a calendar table for a DW and need to create somthing called a scheme quarter.

Basically what i want is for Q1 to start at july 2001 and increment from there.  it will also not reset the number after Q4 ie April 2005 would be Q18.   I am looking for a way to do this without having to create everything manually but can't workout how to do it.  Any help would be greatly appreciated.

MTIA

Kris



Answer this question

populating a calendar table Newbie question

  • Juergen Wenz

    for anyone who may be slightly interested i have managed to do this using the following

     

    set @month=  cast(datepart(mm,@datevalue)as numeric)
     if @Month % 3 = 1 and datepart(dd,@datevalue)=1
      begin
       set @schemeq = @schemeq+1
      end
       insert into Dim_calendar
       (Calendar_Date,scheme_quarter)
      values (@DateValue,@schemeq);
     set @DateValue=@DateValue + 1

     

    Cheers

     

    Kris


  • populating a calendar table Newbie question