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

China☆狼群 提交于 2019-12-11 04:56:15

问题


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:


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




回答2:


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)



来源:https://stackoverflow.com/questions/1832819/whats-the-cheapest-way-to-check-if-a-report-exists-on-my-reporting-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!