Solved

How to find out which reports use a specific stored procedure?

Posted on 2010-08-19
5
419 Views
Last Modified: 2012-05-10
Is there a way to find out which reports refer to a specific stored procedure, other than checking all reports individually?

This is to avoid the situation where a stored procedure is updated correctly for one report, but not realizing that the update breaks other reports that refer to the same stored procedure
0
Comment
Question by:mc_eze
  • 2
  • 2
5 Comments
 
LVL 2

Accepted Solution

by:
rajeshprasath earned 250 total points
Comment Utility
you need to run a profiler and find out all the reports that using the same stored procedure.
0
 

Author Comment

by:mc_eze
Comment Utility
Thanks for the tip
0
 
LVL 2

Expert Comment

by:rajeshprasath
Comment Utility
open all the report rdl files in xml editor and then search the storedprocedure name in seach dialog by checking the all open documents option. you can use editpro or editplus for quickly find the reports.
0
 
LVL 10

Expert Comment

by:itcouple
Comment Utility
Hi

If you want to automate it I suggest to look for some code (eg VBA/VBscript) to loop throught XML files in your solution folder and find the tags which store SP name.

Regards
Emil
0
 

Author Comment

by:mc_eze
Comment Utility
This query turned out to be what was needed. This was found here: http://beyondrelational.com/blogs/jacob/archive/2008/01/16/how-to-find-all-stored-procedures-used-by-report-server.aspx

;WITH XMLNAMESPACES (
DEFAULT
'http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition',
'http://schemas.microsoft.com/SQLServer/reporting/reportdesigner' AS rd

)
SELECT *
name,
x.value('CommandType[1]', 'VARCHAR(50)') AS CommandType,
x.value('CommandText[1]','VARCHAR(50)') AS CommandText

FROM (
select name,
CAST(CAST(content AS VARBINARY(MAX)) AS XML) AS reportXML
from ReportServer.dbo.Catalog

) a
CROSS APPLY reportXML.nodes('/Report/DataSets/DataSet/Query') r(x)
WHERE x.value('CommandType[1]', 'VARCHAR(50)') = 'StoredProcedure'
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now