Last date time of the report run

  • Hi,

    Again its me. Is there any global variable in SSRS which will store the last time when the report ran?

    Or we need to get the value from the database? In SP also, is there any table which stores the last run time of the SP? Or I need to create another table which will store the last date-time for the report?

    Thanks in advance.

  • I do not know of a Global variable that reports last execution time, but you can get it by querying the ReportServer database, but it would probably be easier to create a table and do an insert with Report Name, Procedure Name, and Time whenever you run a report. Something like this will work to get the last execution time of a report:

    SELECT

    C.[Name],

    C.ExecutionTime,

    MAX(EL.TimeStart),

    MAX(EL.TimeEnd)

    FROM

    dbo.ExecutionLog AS EL JOIN

    dbo.[Catalog] AS C

    ON EL.ReportID = C.ItemID

    WHERE

    c.[Name] = 'Your Report Name'

    GROUP BY

    C.[Name],

    C.ExecutionTime

    This execution data is kept for 60 days by default, you can change that in the report server configuration manager.

    You can probably get the last time a stored procedure was run by doing something like this:

    SELECT

    DEST.[text],

    DEQS.last_execution_time

    FROM

    sys.dm_exec_query_stats AS DEQS CROSS APPLY

    sys.dm_exec_sql_text(DEQS.sql_handle) AS DEST

  • Thanks jack,

    I am also thinking to do the same, but your vivid code will help to do the thing faster.

    Thanks a lot.

  • Can someone help me?

    I want to display the last job execution time and date on ssrs report.
     Example if the user run the sales report at 12pm and the sales job schedule last executed at 10am. When the report displays, at the page footer is should display last job execution date/time.

    Thanks

  • marsel - Sunday, February 11, 2018 11:17 PM

    Can someone help me?

    I want to display the last job execution time and date on ssrs report.
     Example if the user run the sales report at 12pm and the sales job schedule last executed at 10am. When the report displays, at the page footer is should display last job execution date/time.

    Thanks

    I want to make sure I understand your question.  Is the scheduled sales job a job that generates a report snapshot or is it a job that does some aggregations and loads a sales reporting table?

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

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