Report Server, Help with SQL, How to calculate NextRunTime for a subscription

  • Unfortunately the SQL server does not give any value in the column NextRunTime

    So can anyone provide the logic how to calculate the NextRunTime columns value.

    USE ReportServer

    GO

    -----------------------------------------------------

    WITH getScheduleInfo AS

    (

    SELECT

    ReportName = CAT.[Name]

    ,ReportPath = CAT.[Path]

    ,SCH.RecurrenceType

    ,SCH.MinutesInterval

    ,SCH.DaysInterval

    ,SCH.WeeksInterval

    ,SCH.DaysOfWeek

    ,SCH.DaysOfMonth

    ,SCH.Month

    ,SCH.MonthlyWeek

    ,SCH.State

    ,SCH.NextRunTime

    FROM dbo.Subscriptions AS SUB

    INNER JOIN dbo.Users AS USR

    ON SUB.OwnerID = USR.UserID

    INNER JOIN dbo.[Catalog] AS CAT

    ON SUB.Report_OID = CAT.ItemID

    INNER JOIN dbo.ReportSchedule AS RS

    ON SUB.Report_OID = RS.ReportID

    AND SUB.SubscriptionID = RS.SubscriptionID

    INNER JOIN dbo.Schedule AS SCH

    ON RS.ScheduleID = SCH.ScheduleID

    )

    SELECT *

    FROM getScheduleInfo

    ORDER BY 1,2

  • You need to join sysjobs and sysjobschedules and then get the next run date/time from sysjobschedules.

    Sue

  • Thanks,

    Also I noticed the interface has changed. Can you help me with the editor. what set of tags should I use for displaying code ?

    it used to be but it did not create a nice frame around the code. Is there another set of tags that I need to use. Please help

  • The web site was been updated and they are working through the issues from all of the changes, data migration, etc.

    I'm having issues with the code tags as well - the editor has the buttons like we used to have with the old site but it's not showing up for everyone. Trying to do it manually doesn't work well. Take a look at this thread and see if you have the same toolbar with the codes like we used to have - Steve posted a screenshot of what his looks like:

    https://www.sqlservercentral.com/forums/topic/sql-formatting-codesql-does-not-work-which-tag-should-be-used#post-3024931

    I'm guessing you might be hitting the same thing and not seeing it - they'll get it fixed.

    I've been just pasting everything for now.

    Sue

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply