change reports datasource through sql script in SQL Server reporting services

时间:2022-09-23 08:17:49

i need an sql script that is going to change the datasource of all reports that are inside of some folder, for example http://localhost/Reports/f1

我需要一个sql脚本,它将更改某些文件夹中所有报告的数据源,例如http:// localhost / Reports / f1

i have 2 datasources(d1 and d2) and 2 folders (f1 and f2) with reports

我有2个数据源(d1和d2)和2个文件夹(f1和f2)和报告

all the reports from f1 have as datasource d2 and i need to set them to d1

来自f1的所有报告都有数据源d2,我需要将它们设置为d1

3 个解决方案

#1


1  

Would the Reporting Services Scripter help?

Reporting Services Scripter会有帮助吗?

#2


1  

well i guess there is no such thing, at least i didn't found it

嗯,我想没有这样的事情,至少我没有找到它

#3


1  

No straight forward answers. But you can achieve if you follow below steps:

没有直接的答案。但如果您按照以下步骤操作,则可以实现:

  1. Download Reporting Services Scripter and generate the scripts with New Parent folder option checked.
  2. 下载Reporting Services Scripter并生成脚本,并选中New Parent folder选项。

  3. Modify the NEWPARENT variable in the .cmd file to your new folder. Make sure you add the "/" if it is from the root folder. For e.g., /NewFolder
  4. 将.cmd文件中的NEWPARENT变量修改为新文件夹。如果它来自根文件夹,请确保添加“/”。例如,/ NewFolder

  5. Open all your *.rss files in notepad++ (or any editor) and globally replace the dsr0.Reference = "/Old_Folder/Old_DataSource" to dsr0.Reference = "/New_Folder/New_DataSource".
  6. 在notepad ++(或任何编辑器)中打开所有* .rss文件,并将dsr0.Reference =“/ Old_Folder / Old_DataSource”全局替换为dsr0.Reference =“/ New_Folder / New_DataSource”。

  7. Execute the .cmd file and that's it.
  8. 执行.cmd文件,就是这样。

Thanks to that person who created the rsScripter. Otherwise I would have ended up sitting and modifying all the datasources.

感谢那个创建rsScripter的人。否则我最终会坐下来修改所有的数据源。

#1


1  

Would the Reporting Services Scripter help?

Reporting Services Scripter会有帮助吗?

#2


1  

well i guess there is no such thing, at least i didn't found it

嗯,我想没有这样的事情,至少我没有找到它

#3


1  

No straight forward answers. But you can achieve if you follow below steps:

没有直接的答案。但如果您按照以下步骤操作,则可以实现:

  1. Download Reporting Services Scripter and generate the scripts with New Parent folder option checked.
  2. 下载Reporting Services Scripter并生成脚本,并选中New Parent folder选项。

  3. Modify the NEWPARENT variable in the .cmd file to your new folder. Make sure you add the "/" if it is from the root folder. For e.g., /NewFolder
  4. 将.cmd文件中的NEWPARENT变量修改为新文件夹。如果它来自根文件夹,请确保添加“/”。例如,/ NewFolder

  5. Open all your *.rss files in notepad++ (or any editor) and globally replace the dsr0.Reference = "/Old_Folder/Old_DataSource" to dsr0.Reference = "/New_Folder/New_DataSource".
  6. 在notepad ++(或任何编辑器)中打开所有* .rss文件,并将dsr0.Reference =“/ Old_Folder / Old_DataSource”全局替换为dsr0.Reference =“/ New_Folder / New_DataSource”。

  7. Execute the .cmd file and that's it.
  8. 执行.cmd文件,就是这样。

Thanks to that person who created the rsScripter. Otherwise I would have ended up sitting and modifying all the datasources.

感谢那个创建rsScripter的人。否则我最终会坐下来修改所有的数据源。