对存储过程的依赖

时间:2015-05-19 14:30:44

标签: ssrs-2008

我有一种情况,我无法更新SSRS报告,但我有权更新与该报告相关的存储过程。更新存储过程后我想如果某些报告使用相同的存储过程...我试图找到存储的依赖关系程序但无法找到SSRS报告的数量取决于Stored Proc..so 只是想知道我能找到多少 SSRS报告取决于一个存储过程吗?

谢谢, sree.k

1 个答案:

答案 0 :(得分:0)

如果您无法搜索特定sp的项目/解决方案(visual studio?), 如果您具有(读取)对ReportServer数据库的访问权限,则可以运行搜索SP的脚本。

对于查询的内容 - 感谢http://bretstateham.com/extracting-ssrs-report-rdl-xml-from-the-reportserver-database/,那么它只是在xml中搜索返回的字符串。 (您要搜索的字符串位于最后一行

--The first CTE gets the content as a varbinary(max)
--as well as the other important columns for all reports,
--data sources and shared datasets.
WITH ItemContentBinaries AS
(
  SELECT
    ItemID,Name,[Type]
    ,CASE Type
    WHEN 2 THEN 'Report'
       WHEN 5 THEN 'Data Source'
       WHEN 7 THEN 'Report Part'
       WHEN 8 THEN 'Shared Dataset'
       ELSE 'Other'
     END AS TypeDescription
    ,CONVERT(varbinary(max),Content) AS Content
    ,Path
  FROM ReportServer.dbo.Catalog
  WHERE Type IN (2,5,7,8)
),
--The second CTE strips off the BOM if it exists...
ItemContentNoBOM AS
(
  SELECT
     ItemID,Name,[Type],TypeDescription
    ,CASE
       WHEN LEFT(Content,3) = 0xEFBBBF
         THEN CONVERT(varbinary(max),SUBSTRING(Content,4,LEN(Content)))
       ELSE
         Content
     END AS Content
     ,path
  FROM ItemContentBinaries
)
--The outer query gets the content in its varbinary, varchar and xml representations...
SELECT * FROM (
SELECT
   ItemID,Path,Name,[Type],TypeDescription
  ,Content --varbinary
  ,CONVERT(varchar(max),Content) AS ContentVarchar --varchar
  ,CONVERT(xml,Content) AS ContentXML --xml
FROM ItemContentNoBOM
)_x
WHERE charindex('dbo.ReportProcToSearchFor',cast([_x].ContentXML as nvarchar(max))) > 0