SSRS报告的副本已发送给订户

时间:2019-08-22 12:53:28

标签: reporting-services subscription

几个SSRS订户正在收到报告的重复副本

确认没有多个订阅

不适用

我希望将SSRS报告的单个副本交付给订阅者

1 个答案:

答案 0 :(得分:0)

您可以查询执行日志以确定报告是否存在任何隐藏的执行。这是我用来实现类似目的的脚本。

连接到您的报表服务器数据库或您的sharepoint集成版本。

WITH subscriptionXmL
AS 
(SELECT 
    SubscriptionID, OwnerID, Report_OID, Locale, InactiveFlags,
    ExtensionSettings, CONVERT(XML, ExtensionSettings) AS ExtensionSettingsXML,
    ModifiedByID, ModifiedDate, Description, LastStatus, EventType, MatchData,
    LastRunTime, Parameters, DeliveryExtension, Version
FROM dbo.Subscriptions
),
    -- Get the settings as pairs
SettingsCTE
AS 
(SELECT
    SubscriptionID ,
    ExtensionSettings ,
    -- include other fields if you need them.
    ISNULL(Settings.value('(./*:Name/text())[1]', 'nvarchar(1024)'), 'Value') AS SettingName,
    Settings.value('(./*:Value/text())[1]', 'nvarchar(max)') AS SettingValue, 
    Report_OID, LastRunTime, LastStatus, InactiveFlags
FROM
subscriptionXmL
CROSS APPLY subscriptionXmL.ExtensionSettingsXML.nodes('//*:ParameterValue') Queries ( Settings ))

select distinct 
ssrs.name,
ssrs.Path,
--convert(varchar(max),ReportQry) ReportQry,
[LastExec] [SQL Last Executed],
subs.SettingName,
subs.SettingValue [Recipients],
InactiveFlags
from
(SELECT top (100) percent Name,
CAST(CAST(Content AS VARBINARY(MAX)) AS XML) AS ReportQry,
ItemID [Report_ID],
Path
FROM dbo.Catalog c
) ssrs
    -- grab the last executed date
    left join  (select max(TimeStart) [LastExec], ReportID from ExecutionLog ex group by ReportID)ex
    on ssrs.[Report_ID] = ex.ReportID

    left join (
            SELECT *
            FROM
                (select dbo.Catalog.Name, SettingsCTE.SubscriptionID, SettingsCTE.SettingName, SettingValue, LastRunTime, LastStatus, Report_OID, InactiveFlags
                FROM
                SettingsCTE JOIN dbo.Catalog on SettingsCTE.Report_OID = dbo.Catalog.ItemID
                WHERE
                settingName IN ( 'TO', 'CC', 'BCC' )
                AND SettingValue IS NOT NULL
            ) subs
            )subs
        on ssrs.Report_ID = subs.Report_OID
 where 
 -- filter down to a report that references a particular object name
 (convert(varchar(max),ReportQry) LIKE '%you object / table / view%')
 -- or filter down to an individual report
 OR ssrs.name like '%your repot name%'