是否可以在Visual Studio中导入现有的SSRS报告?

时间:2011-10-24 11:58:04

标签: visual-studio reporting-services

升级计算机时,我们丢失了用于创建SSRS报告的Visual Studio项目。但是,数据源和报告仍然存在于服务器上。有没有办法使用SQL服务器上的内容重新创建VS项目?有没有办法创建一个新的Reporting Services项目并导入其中的现有数据源和报告?

我认为报告最初是使用VS 2005创建的。

3 个答案:

答案 0 :(得分:10)

你没有太多损失。

数据源并不多:数据库的连接字符串,以及可能的缓存和身份验证设置。这些应该很容易重新创建。

可以为每种报告类型下载报告定义(.rdl文件),并将其添加到新的Reporting Services项目中。他们需要指向新重建的数据源,但是应该没问题。

要下载报告文件,请转到Reporting Services报告管理器(网站)。对于具有默认安装选项的SQL的默认实例,这是http://servername/reports/如果您具有管理员权限,则可以浏览报告。转到给定报告的属性,然后单击“编辑...”按钮。这将通过您的浏览器下载.rdl。 (在SSRS 2008中,“编辑”按钮已更改为“下载...”)

您需要找出正在运行的SSRS版本:Business Intelligence Developer Studio的不同版本(BIDS,Visual Studio的SSAS和SSRS版本)为特定版本的SSRS创建报告。报告可以升级,但不能降级或部署到较早版本的SSRS。

答案 1 :(得分:3)

现在有一个 PowerShell 模块可以很好地完成这项工作。

out-rsfoldercontent -reportserveruri http://[reportserver name]/reportserver -RsFolder /[你想导出的路径] -Destination c:\test -recurse

调整参数以适应。

https://github.com/Microsoft/ReportingServicesTools

答案 2 :(得分:-1)

SSRS不允许您在1 go ...

中从报告文件夹下载所有报告

然而,我找到并调整了一个我在网上找到的一个简单的SQL,我们用它来对我们的系统产生很大的影响......

就是这样: -

/*
People working on SSRS are well aware that “Report Manager” does not support downloading all the report files (.rdl files) at one go out-of-box.
However take this script, alter the xxx parameters to your bits. Its works great.
If you get a HOST Error - you need to set full permission to the SQL Server Group on your DOS Dir. 
on [Our_Prod_Server], this is: SQLServerMSSQLUser$NS226758$MSSQLSERVER

NOTE: You will find a RETURN; statement below, comment it out once you have altered the parameters.
*/

--Replace NULL with keywords of the ReportManager's Report Path,  
--if reports from any specific path are to be downloaded 
--select * from [ReportServer].[dbo].[Catalog] CL -- this gives you an idea of the Report Directories.
DECLARE @FilterReportPath AS VARCHAR(500) = 'xxx'  

--Replace NULL with the keyword matching the Report File Name, 
--if any specific reports are to be downloaded 
DECLARE @FilterReportName AS VARCHAR(500) = '' 

--Replace this path with the Server Location where you want the 
--reports to be downloaded.. 
DECLARE @OutputPath AS VARCHAR(500) = 'C:\Users\[uuuuu]\Documents\Visual Studio 2012\Projects\Report Skeleton\[Report DIR Name]\' 

--Used to prepare the dynamic query 
DECLARE @TSQL AS NVARCHAR(MAX) 

RETURN;

--Reset the OutputPath separator. 
SET @OutputPath = REPLACE(@OutputPath,'\','/') 

--Simple validation of OutputPath; this can be changed as per ones need. 
IF LTRIM(RTRIM(ISNULL(@OutputPath,''))) = '' 
BEGIN 
  SELECT 'Invalid Output Path' 
END 
ELSE 
BEGIN 
   --Prepare the query for download. 
   /* 
   Please note the following points - 
   1. The BCP command could be modified as per ones need. E.g. Providing UserName/Password, etc. 
   2. Please update the SSRS Report Database name. Currently, it is set to default - [ReportServer] 
   3. The BCP does not create missing Directories. So, additional logic could be implemented to handle that. 
   4. SSRS stores the XML items (Report RDL and Data Source definitions) using the UTF-8 encoding.  
      It just so happens that UTF-8 Unicode strings do not NEED to have a BOM and in fact ideally would not have one.  
      However, you will see some report items in your SSRS that begin with a specific sequence of bytes (0xEFBBBF).  
      That sequence is the UTF-8 Byte Order Mark. It’s character representation is the following three characters, “”.  
      While it is supported, it can cause problems with the conversion to XML, so it is removed. 
   */ 
   SET @TSQL = STUFF((SELECT 
                      ';EXEC master..xp_cmdshell ''bcp " ' + 
                      ' SELECT ' + 
                      ' CONVERT(VARCHAR(MAX), ' + 
                      '       CASE ' + 
                      '         WHEN LEFT(C.Content,3) = 0xEFBBBF THEN STUFF(C.Content,1,3,'''''''') '+ 
                      '         ELSE C.Content '+ 
                      '       END) ' + 
                      ' FROM ' + 
                      ' [ReportServer].[dbo].[Catalog] CL ' + 
                      ' CROSS APPLY (SELECT CONVERT(VARBINARY(MAX),CL.Content) Content) C ' + 
                      ' WHERE ' + 
                      ' CL.ItemID = ''''' + CONVERT(VARCHAR(MAX), CL.ItemID) + ''''' " queryout "' + @OutputPath + '' + CL.Name + '.rdl" ' + '-T -c -x''' 
                    FROM 
                      [ReportServer].[dbo].[Catalog] CL 
                    WHERE 
                      CL.[Type] = 2 --Report 
                      AND '/' + CL.[Path] + '/' LIKE COALESCE('%/%' + @FilterReportPath + '%/%', '/' + CL.[Path] + '/') 
                      AND CL.Name LIKE COALESCE('%' + @FilterReportName + '%', CL.Name) 
                    FOR XML PATH('')), 1,1,'') 

  --SELECT @TSQL 

  --Execute the Dynamic Query 
  EXEC SP_EXECUTESQL @TSQL 
END