使用SSR中的按钮执行存储的过程代码
我已经创建了一个报告,该报告显示了我们的报告服务器上的所有活动订阅,并且目前有一个表显示了所有报告,我还包括了3列,其中一列显示了您启用订阅的代码,其中一个显示您代码禁用订阅,最后一个显示代码以立即运行订阅。
我已经看了制作这些列按钮/可单击的文本,以便用户可以单击按钮/文本,并能够启用/disable/run订阅,因此与我自己不是一个失败点。我还找不到任何让我这样做的东西。
有谁知道这是否可能,并且可以为如何/可以提供一些指导吗?
这是报告的SQL:
SELECT
cat.Name,
cat.Path,
sub.Description,
sch.ScheduleID AS AgentJobID,
sch.LastRunTime,
CASE sch.RecurrenceType
WHEN 1 THEN 'Once'
WHEN 2 THEN 'Hourly'
WHEN 4 THEN 'Daily/Weekly'
WHEN 5 THEN 'Monthly'
END AS ScheduleFrequency,
'EXEC msdb.dbo.sp_start_job N''' + CAST(sch.ScheduleID as nvarchar(36)) + ''';' AS StartJob,
'EXEC msdb.dbo.sp_update_job @job_name = N''' + CAST(sch.ScheduleID as nvarchar(36)) + ''', @enabled = 1 ;' AS EnableJob,
'EXEC msdb.dbo.sp_update_job @job_name = N''' + CAST(sch.ScheduleID as nvarchar(36)) + ''', @enabled = 0 ;' AS DisableJob
FROM
ReportServer.dbo.Schedule sch
INNER JOIN
ReportServer.dbo.ReportSchedule rsch
ON sch.ScheduleID = rsch.ScheduleID
INNER JOIN
ReportServer.dbo.Catalog cat
ON rsch.ReportID = cat.ItemID
INNER JOIN
ReportServer.dbo.Subscriptions sub
ON rsch.SubscriptionID = sub.SubscriptionID
I've created a report which shows all active Subscriptions on our Report Server and have currently got a table showing all the reports by name and I've also included 3 columns, one which shows you the code to Enable the subscription, one which shows you code to Disable the subscription and the last one shows code to Run the subscription immediately.
I've had a look at making these columns buttons/clickable text so a user can just hit the button/text and are able to Enable/Disable/Run subscriptions so it's not a single point of failure with myself. I've not been able to find anything yet which allows me to do this.
Does anyone know if this is possible and could provide some guidance on how this is/could be done?
Here's the SQL for the report:
SELECT
cat.Name,
cat.Path,
sub.Description,
sch.ScheduleID AS AgentJobID,
sch.LastRunTime,
CASE sch.RecurrenceType
WHEN 1 THEN 'Once'
WHEN 2 THEN 'Hourly'
WHEN 4 THEN 'Daily/Weekly'
WHEN 5 THEN 'Monthly'
END AS ScheduleFrequency,
'EXEC msdb.dbo.sp_start_job N''' + CAST(sch.ScheduleID as nvarchar(36)) + ''';' AS StartJob,
'EXEC msdb.dbo.sp_update_job @job_name = N''' + CAST(sch.ScheduleID as nvarchar(36)) + ''', @enabled = 1 ;' AS EnableJob,
'EXEC msdb.dbo.sp_update_job @job_name = N''' + CAST(sch.ScheduleID as nvarchar(36)) + ''', @enabled = 0 ;' AS DisableJob
FROM
ReportServer.dbo.Schedule sch
INNER JOIN
ReportServer.dbo.ReportSchedule rsch
ON sch.ScheduleID = rsch.ScheduleID
INNER JOIN
ReportServer.dbo.Catalog cat
ON rsch.ReportID = cat.ItemID
INNER JOIN
ReportServer.dbo.Subscriptions sub
ON rsch.SubscriptionID = sub.SubscriptionID
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我目前正在尝试自己做类似的事情,希望这可以对您有所帮助。
目前,我设法实现这些目标的唯一解决方案是将动作进行报告的“ onClick”事件的图像或其他对象。然后,我在此子报告中有一个数据集,该数据集使用根据需要从父报告中传递到的参数执行存储过程。下面的一些图像可能有助于阐明我的工作方式:
不幸的是,这可能有点笨拙,因为它打开了一个子报告,如果用户需要操作多个结果,则必须退出。
I am currently attempting to do something similar myself, I hope this may help you in some way.
Currently the only workaround I have managed to achieve something along these lines is to have an image or other object with an "onclick" event that actions Go To Report. I then have a dataset in this SubReport that executes the Stored Procedure using paramaters passed into it from the parent report as required. Some images below may help clarify how I did it:
Unfortunately, it can be a bit unwieldy since it opens up a sub report that the user has to navigate back out of if they need to action multiple results.