SQL Server Performance

Leap Year calculation in SSRS

Discussion in 'SQL Server 2005 Reporting Services' started by Anirban Biswas, Feb 28, 2008.

  1. Anirban Biswas New Member

    I am using SSRS interface to create and schedule a report.
    The report parameters are as below...
    Start Date: 01/03/2008 (dd/mm/yyyy)
    End Date: 12/12/2009 (dd/mm/yyyy)
    Schedule Details: Monthly (Feb) on 29th
    Which means the report should not execute as 29th Feb will not appear on 2009. This date will come only in 2012 which is a leap year.
    What SSRS does is, it creates a report and schedules it on 29th March 2009 (29/03/2009)
    Which is wrong.
    We have tried this issue several times with different date combination and the result was same.

    Did any one come accross this type if issue? If yes please let me know the solution. Is this a SSRS BUG??
    With regards
  2. martins New Member

    What if you change the end date to 2012? Do you still get the same?
    Another question: Why dont you just schedule it to run on 29 Feb 2012, as you know this will be the only time it needs to run?
  3. Adriaan New Member

    It would need to run this year too.[;)]
    I guess it needs to run once a year, the day before March 1. Perhaps 00:00 AM on March 1 is close enough?
  4. martins New Member

  5. jagpalsingh4 New Member

    I Need ur help will u plz tell me how can we see all locks from server and session name ,session id with t-sql statements
    thaxxx .
    if u solve this
    jagpal singh
  6. Adriaan New Member

    Jagpal - you're on the wrong thread here.
  7. Madhivanan Moderator

    In case if you want to know last day of Feb, then
    select dateadd(month,2,dateadd(year,datediff(year,0,getdate()),0))-1
  8. dineshasanka Moderator

    You change the report schdule to be run in last date of the month
  9. Lukasz New Member

    Anirban -
    Yes, this is a bug in SSRS. I filed a bug internally to address it in SQL Server 2008. Essentially, this is an artifact of some logic we have in RS that is required to ensure the correct schedule is created in SQL Agent. Unfortunately, it does not account for leap years.
    What this affects:
    It affects recurring schedules that run every February 29th. This is somewhat uncommon.
    What it does not affect:
    You can still create schedules that run on February 29th, if they are not recurring. So you can create a schedule with recurrence "once" that runs today.
    My recommendation for issues like this is to file a bug on http://connect.microsoft.com if you continue to see issues with dates.
  10. Rubix New Member

    As a work around create a subscription to run on first of every month and use (currentdate - 1) as your report parameter.

Share This Page