开发者

What's the "cheapest" way to check if a report exists on my Reporting Server?

开发者 https://www.devze.com 2022-12-12 21:41 出处:网络
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

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......


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)


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

0

精彩评论

暂无评论...
验证码 换一张
取 消