SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Cache Report via SQL commands


Cache Report via SQL commands

Author
Message
evan.penalba
evan.penalba
Forum Newbie
Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)

Group: General Forum Members
Points: 7 Visits: 6
Hello,
I'd like to cache a few reports at the same time using a SQL statement.
Currently I have to go to each SSRS report-->Manage-->Caching-->Click "Create a cache snapshot when I click Apply on this page" --> Apply
I am looking at some kind of SQL code that I can use to execute that will then caching the report on demand.

I do something similar with SQL and executing subscriptions to run right now, without having to go to the report itself, change the subscription time, wait a minute, then put it back.

Thank you.
Sue_H
Sue_H
SSC-Dedicated
SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)

Group: General Forum Members
Points: 33306 Visits: 9534
evan.penalba - Friday, December 8, 2017 12:40 PM
Hello,
I'd like to cache a few reports at the same time using a SQL statement.
Currently I have to go to each SSRS report-->Manage-->Caching-->Click "Create a cache snapshot when I click Apply on this page" --> Apply
I am looking at some kind of SQL code that I can use to execute that will then caching the report on demand.

I do something similar with SQL and executing subscriptions to run right now, without having to go to the report itself, change the subscription time, wait a minute, then put it back.

Thank you.


If you are going to refresh a cached report, It's the same with executing ReportServer.dbo.AddEvent.
EventType is 'RefreshCache' and EventData is subscription id.

However, you are talking about a snapshot, not a cached report - the wording on that in Report Manager is a bit confusing. If you wanted to be able to create a snapshot on demand, you would probably want to schedule time to create the report snapshot. Then you can update that on demand using the same - executing AddEvent.
EventType is 'ReportExecutionUpdateSchedule' and EventData is the report id.

Sue



evan.penalba
evan.penalba
Forum Newbie
Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)

Group: General Forum Members
Points: 7 Visits: 6
Thank you. I was able to get close to what I was trying to do, but does not seem to be kicking off the Cache refresh. My logic below:

---Find the Schedule ID for the report in question.
select [ScheduleID]
,[ReportID]
,[SubscriptionID]
,[ReportAction]
, c.Name
FROM [ReportServer].[dbo].[ReportSchedule] r
left join Catalog c on c.ItemID = r.ReportID
where
c.Path like '%/xyz/%'
and r.ReportAction <> 4 --eliminate Email Subscriptions
and c.name in (
'Report Name - ABC'
)

---- Execute the cache for that report.
exec ReportServer.dbo.AddEvent @EventType = 'RefreshCache'
, @EventData = 'FC792F92-2FB3-4D81-BA3D-C9ABCF6EF90C' -- ScheduleID from the 'ReportSchedule' results
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search