question

jayavel avatar image
jayavel asked

How to get SSRS subscription history

Is is possible to get the history of SSRS subscription? I can able to find the status of the last subscription details and execution details for the report. I want to know if there is any possible to get the subscription wise execution log details.

ssrs-subscription
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

WRBI avatar image
WRBI answered

Just a pointer in the right direction, you can use the ExexcutionLogs in the ReportServer DB

SELECT	*
FROM	ReportServer.dbo.ExecutionLog3
WHERE	RequestType = 'Subscription'

There's ExecutionLog, ExecutionLog2 and ExecutionLog3

Have a look through the columns in those views and you should be able to get all the information that you need

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

jayavel avatar image
jayavel answered

thanks for ur reply. The above query result will display all subscription details for a particular report. I want to get the individual subscription wise details....

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

WRBI avatar image
WRBI answered

I'm not sure I totally understand, but maybe this will get you in the ball park.

;WITH BaseData
AS (
   -- Convert the ExtensionSettings column to XML so that we can work with it.
   SELECT s.SubscriptionID,
          c.Name AS ReportName,
          c.Path AS ReportPath,
          CONVERT (XML, s.ExtensionSettings) AS ExtensionXML,
          c.Hidden
   FROM ReportServer.dbo.Subscriptions AS s
       INNER JOIN ReportServer.dbo.Catalog AS c
           ON c.ItemID = s.Report_OID),
      ShreddedData
AS (
   -- Shred the XML data to get at what we want.
   SELECT BaseData.SubscriptionID,
          BaseData.ReportName,
          BaseData.ReportPath,
          COALESCE (Extensions.value ('(./*:Name/text())[1]', 'nvarchar(3000)'), 'Value') AS SettingName,
          Extensions.value ('(./*:Value/text())[1]', 'nvarchar(max)') AS SettingValue,
          BaseData.Hidden
   FROM BaseData
       CROSS APPLY BaseData.ExtensionXML.nodes ('//*:ParameterValue') AS Query(Extensions) )




SELECT *
FROM ShreddedData
WHERE SettingName IN ( 'TO', 'CC', 'BCC' );

Note that there are different settings, remove the final WHERE clause to see them all and then you can select whatever you want to. Not all columns are included, play around with it to get what you want. You can always join to the execution logs if you need to.

Hope that helps.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.