Month/Year Calendar

I also need a calendar that only shows each month in the year, I thought I had my script perfect, but it gives me an entry for each day in the month.  I only want ONE month per year...
Declare @begin DateTime, @end DateTime
Select @begin = '2013-01-01', @end = '2014-12-31'
Create Table MonthYear
(Year Int, Month varchar(1000))
While @begin <= @end
Begin
Insert Into dbo.MonthYear (Year, Month)
Select DatePart(yy, @begin) As Year,
DateName(MM, @begin) As Month
Set @begin = DateAdd(Day, 1, @begin)
End

What about changing this line:
  Set @begin = DateAdd(Day, 1, @begin)
Erland Sommarskog, SQL Server MVP, [email protected]
To?

Similar Messages

  • Report filtered by month/year

    To gurus:
    I am creating a pivot table report that must be filtered on 'page section' by month/year.
    I am trying to use the specif colum formula upon "Service Request"."Opened Date" to group the result by this specific filter with no sucess.
    well, I can group by 'month' or 'year' but not the both as well.
    Could someone help me?
    Thanks in advance.
    Mtb

    While creating a report, on the left of the screen, you have access to the fields. Fields are classified by entity (Service Request, Account, ...) and you have to click the "+" to display the fields of an entity.
    Here you have an entity named Date Opened. If you click on the "+", you have fields such as Calendar Month/Year, Calendar Week/Year, Calendar Quarter, ...
    It replace the job of the cast...
    Max

  • How to have few distincts colors per day on the year calendar, ( like month or day calendar ) thank

    When i use Ical, ( dayly, week, month ) i can have lot of distinct colors for each days, few colors in the same day,
    When i use Ical ( year ) just one color appear each day,
    Can i change that to have the same wiev of day in each calendar ( ex: in the year calendar, how to see i've doctor the 2013 01 10 in blue
    the teacher the 2013 01 10 in yellow and pay the taxe the 2013 01 10 in red )
    thank for reply
    sorry for my english

    I believe, I have answered my own question....
    thx

  • FM to get previous fiscal month/year and calendar month/year for a date.

    Hi All,
    I am having a requirement to extract some data based on either the previous fiscal month/year or the previous calendar month/year. There is no company code input to find the fiscal/calendar month/year.
    At selection screen, user can select either fiscal or calendar selection.
    Based on the selection, the data will be extracted.
    For the system date, we need to calculate previous fiscal month/year or previous calendar month/year and populate the calculated data back to the selection-screen.
    Can you one of you please suggest an FM to find previous fiscal month/year and previous calendar month/year.
    Thanks in Advance,
    Regards
    Gowthami

    Hi Gowthami,
    You can use following function module to calculate previous / next day or month or year.
       call function '/SAPHT/DRM_CALC_DATE'
          exporting
            date      = sy-datum
            days      =
            months    =
            sign      = '-'
            years     =
          importing
            calc_date = .
    Here, you can give '-' to sign, if you want previous day / month / year.
    Here, you can give '+' to sign, if you want next day / month / year.
    And depending upon your requirement, you can pass suitable value to days / month / year.
    e.g. To calcualte last month,
       call function '/SAPHT/DRM_CALC_DATE'
          exporting
            date      = sy-datum
            days      =
            months    = 1
            sign      = '-'
            years     =
          importing
            calc_date = wv_prev_month.
    so it will give '23-01-2008' . Then convert it in the required format as per your requirement using string function concatenate.
    Hope this help you.
    Regards,
    Anil

  • Need to display "Calendar Month/Year" at report level from Calendar Day

    Hello Experts,
    I have a scenario in which I have 0CALDAY (e.g. 01.01.2009) along with other fields available in my report. My requirement is to display "Calendar Month/Year" (01.2009) in my report. Is it possible to have "Calendar Month/Year" in my report from 0CALDAY, by making changes to the query, as I cannot remodel the underlying InfoCube.
    Many Thanks,
    VA

    What you mean with huge - 100 Mio dataset?
    The import of the new infocube will be also take a long time - the database must be insert a new field for every dataset.
    => is this a big infocube, then don't use virtual infoobjects.
    => on a big infocube is important to have a good datamodel - please insert always all 11 infoobjects for the time dimension.
    Sven

  • To Display "Calendar Month/Year" at report level from Calendar Day

    Hello Friends,
    I have a scenario in which I have 0CALDAY (e.g. 01.01.2009) along with other fields available in my report. My requirement is to display "Calendar Month/Year" (e.g. 01.2009) in my report.
    Is it possible to have "Calendar Month/Year" in my report from 0CALDAY, by making changes to the query, as I cannot remodel the underlying InfoCube?
    Many Thanks,
    VishwA

    HI Vishwa,
    Hope it will helps.
    How to get month from CREATE DATE field??
    Regards,
    SVS

  • Getting month from Calendar Year/month...

    Dear All,
    I'm using Webi 4.0 SP6 and I need to get months from Calendar Year/Month which I'm using in a query to display on Cross Table along with brands.
    1. Is there any standard function available to convert Calandar Year/Month (Say: 201401 to Jan or January).?
    2. How can I get month from Calendar Year/Month for cross-table?
    I will appreciate your reply.
    Many Thanks!!!
    Tariq Ashraf

    Tariq,
    Month =  Substr([Cal Year];5;2)
    Month Name = If Substr([Cal Year];5;2) = "01" then "Jan"
                             else if Substr([Cal Year];5;2) = "02" then "Feb"
                             else if Substr([Cal Year];5;2) = "03" then "Mar"
                             else if Substr([Cal Year];5;2) = "04" then  "Apr"
                             else if Substr([Cal Year];5;2) = "05" then  "May"
                             else if Substr([Cal Year];5;2) = "06" then  "Jun"
                             else if Substr([Cal Year];5;2) = "07" then   "Jul"
                             else if Substr([Cal Year];5;2) = "08" then  "Aug"
                             else if Substr([Cal Year];5;2) = "09" then   "Sep"
                             else if Substr([Cal Year];5;2) = "10" then   "Oct"
                             else if Substr([Cal Year];5;2) = "11" then  "Nov" else "Dec"
    If you have data like 20140101 then simply use = formatdate([Date];"Mon")

  • Dynamic selection of Calendar month/year

    I need to create a dynamic combo for calendar month/year, which will display the last 3 months.
    I have a query that displays the cumulated amounts for the last three months and I need to have a combo with the option to filter the query for only one of these months...
    How can I do that in Visual Composer?
    Thanks in advance,
    Cris

    Hi Cris,
    The simplest way is to create a service that's returns the correct month and use it as dynamic list for the drop-down.
    Hope it helps,
    Shay

  • Date Calculations - Adding 1 to the day and adjusting month/year

    Hi all,
    I have a date field in MM/ DD/ YYYY format. If I add 1 to the DD (day) field, and I hit the end
    of the month/year I need to adjust the MM and YYYY accordingly.
    Is there is an existing class/method in the JAVA API that would handle somthing like this??
    If so , I can't find it..... I don't want to re-invent the wheel creating a Date Handling routine just
    for this program.......
    Thanks very much

    This is overkill... (and sorry that this post is over a year later than the original post... hopefully somebody will benefit from it :)
    Calendar.getInstance() by default instanciates a GregorianCalendar
    object. (check the src).
    Therefore:
    Calendar cal = Calendar.getInstance();
    cal.setTime(d); // where d = java.util.Date or java.sql.Timestamp
    cal.add(Calendar.DATE, numberOfDays);
    return cal.getTime();
    public static java.util.Date
    adjustDateBy(java.util.Date d, int numberOfDays) {
    java.util.GregorianCalendar cal = new
    java.util.GregorianCalendar();
         cal.setTime(d);
    cal.add(java.util.GregorianCalendar.DATE,
    numberOfDays);
         return cal.getTime();

  • How do I create a new calendar for the current year, using last years calendar's birthday's/photos and comments from the lower pages?

    Each year for the past 5 years I make a family calendar and send copies to all he family members around the globe.  I hate that I have to recreate all the birthdays and special occasions from scratch, and re-drag all the photos onto these dates, in the lower half of the page of each month on the new calendar.  How can I create a new calendar for the current year and port all of these photos/comments into the new calendar from last years calendar, to save having to redo all this work!!  I am not talking about the upper half page of the photos only...I am referring to the calendar page of each month.
    Thanks in advance. 
    Colin

    Welcome to the Apple Discussions. Open iWeb so you see your original site in the left hand pane. Use the File->New Site menu option to create a new site. Give it the name you want.
    Now select a page in your original site and type Command+D. That will duplicate the page. Drag the duplicate page down to the new site and rename it as needed. Do that for the other pages you need in the original site.
    OT

  • Studio : Chart Based on day/month/year

    In Studio , There is a requirement for us to display chart based on day/month/year .
    Since Date attribute is not displayed as a Dimension in the chart configuration list , I have divided  date attribute into  day/month/year attributes and based on that I generated a sample chart
    But now I'm facing with a problem
    Suppose there are records for only July and Sep then the chart shows up for July and Sep , It doesn't show up for august.
    I agree that there are no records for august in my data domain that is the reason august is not displayed in the chart . But as per our requirement we should display august as well with zero count.
    I'm curious to know if there is any way to do this .

    The idea behind the calendar record type is it is a secondary, new record type you're introducing that compliments your "sales" record type.  The RECORDs you provided would be your "sales" record type, not your "calendar" record type.  To continue with your example, your "sales" records would look like what you provided:
    =============== RECORD ==================
    Id: 1
    sales_amount : 1000
    Month: Oct
    RecordType: sales
    date: 2012-10-01T00:00:00.000Z
    day: 01
    year: 2012
    =============== RECORD ==================
    Id: 5
    sales_amount: 1000
    Month: Dec
    RecordType: sales
    date: 2012-12-01T00:00:00.000Z
    day: 01
    year: 2012
    ==========================================
    And your "calendar" record type would be loaded subsequently.  I usually provide one Endeca record for every day for this record type:
    =============== RECORD ==================
    Id: 1
    Month: Oct
    RecordType: calendar
    date: 2012-10-01T00:00:00.000Z
    day: 01
    year: 2012
    =============== RECORD ==================
    Id: 2
    Month: Oct
    RecordType: calendar
    date: 2012-10-02T00:00:00.000Z
    day: 02
    year: 2012
    ==========================================
    (and so on, one for each day up to today...yawn)....
    =============== RECORD ==================
    Id: 790
    Month: July
    RecordType: calendar
    date: 2013-07-31T00:00:00.000Z
    day: 31
    year: 2013
    ==========================================
    Thus, when you write an EQL statement like:
    RETURN foo AS SELECT
    SUM(sales_amount) AS "TotSales"
    GROUP BY Month
    You will get a Month bucket for every month, where the "calendar" record type will be sure to offer a month where sales don't offer it...aka. fill in any "holes".
    HTH,
    Dan
    http://branchbird.com

  • Date for Month year only?

    I Have a report being done where, the user wants to see the 'slow moving inventory' for a 2 month period.
    It's not automatic, the past 2 months. they can select which 2 months they want. So, I was thinking of the best way for the parameters.
    Maybe just have them enter one? month/year. but in any case if i do a from and to, I dont' need the entire calender- is there  a way to display just the month and year? if not i can create the parameter that way.

    I would create a command (SQL Select statement) to use for data for a dynamic prompt.  It might look something like this in Oracle (allows for two full calendar years in the past):
    Select distinct
    To_Char(OrderDate, 'MMM-YYYY')  as MonthYear
    from Orders
    where EXTRACT(Year from OrderDate) >= (EXTRACT(Year from Sysdate) - 2)
    Or like this in SQL Server:
    Select distinct
    Left(DateName(month, OrderDate), 3) + '-' + DateName(year, OrderDate) as MonthYear
    from Orders
    where Year(OrderDate) >= (Year(GetDate()) - 2)
    DO NOT link the command to anything in the report - its sole purpose is to provide data for a dynamic prompt.  Crystal will complain that this is generally not supported, but it will work in this situation.
    Now create a dynamic parameter that will use this data - DO NOT use any other data from your report tables!  This parameter will identify the start month for the report.
    Lastly, you'll need to create a two formulas - one that will calculate the start date from the parameter value and another that will create the end date.  If the parameter is called {?StartMonth}, they might look like this:
    {@StartDate}
    StringVar monthName := UpperCase(Left({?StartMonth}, 3));
    //get the month number
    NumberVar mn := Switch (
      monthName = 'JAN', 1,
      monthName = 'FEB', 2,
      monthName = 'DEC', 12);
    //get the Year number
    NumberVar yr := ToNumber(Right({?StartMonth}, 4));
    //return the first day of the start month:
    Date(yr, mn, 1)
    {@EndDate}
    //Subtract one day from the start of the month 2 months after the start date to get the end of the
    //month after the start date
    DateAdd('m', 2, {@StartDate})  -  1 
    Use these formulas in your selection criteria for your report.
    -Dell

  • Printing a yearly calendar with iCal?

    I want to print a yearly calendar in both letter and half letter format with my iCal, how do I do that?

    No, I don't see this option either... I've exhausted every option inside iCal and my advanced print settings.
    The only other suggestion is to go to iCal and "provide iCal feedback" within the menu bar and request this feature.
    I will do this as well.
    In the meantime a workaround is:
    Select "month view" in the print settings - select 12 months to print and select "ok".
    Then your printer options will open up.
    From there click the Layout drop down tab, and then select "16 pages" per sheet.
    Then they will all print on 1 page... though the numbers are too small to really be deemed "legible".
    You may want to mess around with zoom settings after you arrange 16 pages per sheet.
    This is the only workaround to get "close" to what you want to do.

  • 'Calendar UI' which will display current month's calendar in one line

    Hi Experts,
    I have to create a calendar in following way. Here I have to display calendar of current month for the employee. The entire month detail has to appear in one line. In fact it is needed for Leave Overview iView.
    Manager needs to view the Leave details of all employees working in his department
       1                 2                  3              4           5         6                 7              8            9               10   11     12     13     14     15  16 17 18 19  20 21  22 23  24  25  26  27  28  29 30 31
       Mon    Tues    Wed    Thurs   Friday  Sat            Sun
    Smith  
    Marteen
    Thomas
    I am not sure how to do it? Do we have any ready made UI element which we can use. I can see Date navigator. However it
    displays the calendar in 4 rows.
    Please help.
    Regards,
    Gary

    Hi Abhinav, Experts
    Thanks. The design of my RFC will be like this:
    1) Input Org Unit, Month, Year
    2) Output
    Pernr (datatype number 8)
    Name (datatype string)
    Day1 (datatype string)
    Day2 (datatype string)
    Day3 (datatype string)
    Day4 (datatype string)
    Day29 (datatype string)
    Day30 (datatype string)
    Day31 (datatype string)
    3) The default value Day1, Day2  etc will be null
    4) I will find out Leave Details. If Leave has been approved for say Day5 then I will populate Day5 = 'AP'.
    5) I will write another logic to make the color of cell as 'Green' for Day5.
    6) In Feb 2011, there are 28 days. There will be another logic to make the Day29, Day30, Day31 invisible for months like Feb 2011.
    Please let me know if this approach is correct.
    Please also let me know how to display day i.e. 01.04.2011 is Friday. In Calendar I have to display
                     1.4.2011  2.4.2011   3.4.2011
                     Friday      Saturday   Sunday
    Smith
    Tony
    I did small Proof of Concept. The table does not look good although displays the information.
    Please help.
    Regards,
    Gary

  • Calander Date format(month year)

    Hi All,
      I am using the Date format (month year, 'January 2009') to  QaaWs as a input. But when i go into Xcelsius calendar i am trying to give the same format but its not taking  as same as mentioned above( I customize the cell in xcelsius spread sheet as month year). Is there any thing to change?
    Please help me.
    Thanks in advance.
    Muvva

    The month in words datatype is FCLTX.
    If you have the date field, you can convert to your required format.
    data : out_date(20) type c.
    DATA : ws_fcmnr TYPE fcmnr,
           ws_month TYPE fcltx.
    parameter   date like sy-datum.
    ws_fcmnr = date+4(2).
    SELECT SINGLE ltx
    INTO ws_month
    FROM t247
    WHERE mnr = ws_fcmnr
    and spras = 'EN'.
    concatenate ws_month date6(2) date0(4) into out_date separated by space.
    write out_date.
    Thanks,
    Susmitha
    Dont forget to reward points for useful answers.

Maybe you are looking for

  • ITunes 12.1.0.50 won't recognize Nono Gen 5 on iMac 10.10.2

    I am using iTunes 12.1.0.50 on my 27" iMac loaded with Yosemite 10.10.2 and it will not recognize my iPod Nano 5th Generation.  It will recognizr my older iPods, but not that one. I've tried connecting it directly to the back, via a hub but no differ

  • Free App Promotion

    Is anyone else having problems with the palm.com/appspromo website? I purchased a new HP Veer to replace my trusty Pre Plus.  In the box came an offer to download 1 free app from a select list of apps.  When I go to the website and choose my app (auc

  • Top install error on Solaris 10 X64

    Hi, I am trying to compile Top 3.7 on Solaris 10X64 update 7, the compiled binary can be runned in the building directory, but can't run when installed, the error message is as following: # gmake install cp -f /usr/lib/isaexec top mkdir -p /usr/local

  • Unable to access CMS console after system crash and full restore

    Our Crystal Reports server failed after a sudden power outage. When power was restored, the Windows 2003 server failed to boot. It had to be completely restored from backup. Now we have Business Objects Infoview (BOBJ 11.5) back up and running and Cr

  • Clock is wrong after reset

    The clock on my computer resets to about 5 hours ahead of the actual time every time I restart. As soon as I open the Date and Time prefpane it corrects itself, but it's still a problem. I'm thinking it may be a hardware issue because my Vista instal