views:

201

answers:

2

Given a SQL Server 2008 Reporting Services installation, what's the "cheapest" way to check whether a given report (given by its report name + report path, e.g. /MyReports/SomeOddballReport) exists (or not) ?

I see lots of potential candidates on the ReportServer web service - which one is the quickest and the one using the least amount of system resources??

  • FindItems()
  • GetReportDefinition()
  • GetReportLink()
  • GetProperties()

Any others I'm missing? Thanks for any hints and pointers! I find the Reporting Services webservice interface to be lacking in documentation and samples, really......

+1  A: 

Seems fastest way is to use FindItems method.

All other options seems to be metadata related, as them retrieve properties for that items (so it needs to find item first and, so, get those metadata)

Rubens Farias
+4  A: 

Hi marc_s,

Due to MS Reporting Services running on MS SQL you have an easy option to return report names and to see if a report exists. Inside of SQL Server there is a database called ReportServer. Within that database is a table that is called Catalog. The Catalog table stores data sources, reports, and some other vital information. The key fields are the "Name" and the "Type". Type distinguishes between a report / a datasource / etc. Name of course is obvious, it is the name of the report.

To get all reports on your reporting service instance try this:

USE ReportServer
GO
SELECT Name, Description FROM Catalog WHERE Type=2

To get all data sources:

USE ReportServer
Go
SELECT Name, Description FROM Catalog WHERE Type=5

So if you have a name or at least know of what a report starts with you can do a LIKE query:

SELECT Name FROM Catalog WHERE Name LIKE '%Employee Report%'

Check out my blog for more info:

http://weblogs.sqlteam.com/jhermiz/archive/2007/08/14/60285.aspx

Also since you mentioned it therte is a path field which may contain data like this:

/ETime/Job Hours Summary By Department

JonH
+1 good point! I'll have to investigate that a bit more - thanks for the hint!
marc_s
@JonH, I use to do Sharepoint programming and Microsoft recomends do not access it's database directly; Are there some recommendation like that for Reporting Server?
Rubens Farias
@Rubens - MS did not recommend for the portal because of how sensitive the portal is due to the number of configuration databases. The ReportServer database is not near as complicated as Sharepoint, in fact sharepoint is simply a beast compared to it!. The originator of this post wants a simple efficient way of pulling report names, there is no mention of insert or deletes. I would be weary of deletes unless you know what you are doing.
JonH