sql2012 ssrs

In the SQL Server Reporting Service (SSRS) report development process; we can use a beneficial feature which is called the “shared dataset”. The purpose of SSRS embedded datasets are to retrieve data from target data sources for only one report but a shared dataset can be used by multiple reports to retrieve data.

在SQL Server报表服务(SSRS)报表开发过程中; 我们可以使用一个有益的功能,称为“共享数据集”。 SSRS嵌入式数据集的目的是仅从一个报告的目标数据源中检索数据,但是多个报告可以使用共享的数据集来检索数据。

And, also using SSRS shared dataset provides some advantages that differ than the embedded datasets, such as a caching mechanism which is the essential property of shared datasets. Another flexibility of SSRS shared datasets is simple management capability. If you change any setting of shared dataset, this change will automatically be applied to all SSRS reports which used this shared dataset. It is necessary to pay attention to one point about shared dataset, though, that is if we want to use shared dataset in SSRS, we have to use a shared data source. Now, we will explore some details about SSRS shared data sources and then go into the details of shared datasets.

并且,还使用SSRS共享数据集提供了一些与嵌入式数据集不同的优点,例如缓存机制是共享数据集的基本属性。 SSRS共享数据集的另一个灵活性是简单的管理功能。 如果更改共享数据集的任何设置,则此更改将自动应用于使用此共享数据集的所有SSRS报告。 但是,有必要注意关于共享数据集的一点,即如果要在SSRS中使用共享数据集,则必须使用共享数据源。 现在,我们将探索有关SSRS共享数据源的一些细节,然后进入共享数据集的细节。

A data source can be defined as a connection structure which includes connection details (Database IP, Name etc.) and security credentials about target data resources. The key difference between embedded and shared source is that shared data source can be used by multiple reports and data-driven subscriptions. This type of data source provides us with management simplicity in data connection management. You can easily change database security or connection settings of reports which were applied to shared data source before. But if you use embedded data source, you need to review all reports. We can create shared data source in different ways. It can be created in the SSRS web portal, Report builder or in Visual Studio. In this article, we will use Microsoft SQL Server Data Tools for Visual Studio 2017. At the same time with Microsoft SQL Server Data Tools for Visual Studio 2017 we can develop Integration Services, Analysis Services and SSRS report server projects.

数据源可以定义为一种连接结构,其中包括连接详细信息(数据库IP,名称等)和有关目标数据资源的安全凭证。 嵌入式源和共享源之间的主要区别在于,共享数据源可以由多个报表和数据驱动的订阅使用。 这种类型的数据源为我们提供了数据连接管理中的管理简便性。 您可以轻松更改以前应用于共享数据源的报表的数据库安全性或连接设置。 但是,如果您使用嵌入式数据源,则需要查看所有报告。 我们可以用不同的方式创建共享数据源。 可以在SSRS Web门户,报表构建器或Visual Studio中创建它。 在本文中,我们将使用Visual Studio 2017的Microsoft SQL Server数据工具。与此同时,我们将Visual Studio 2017的Microsoft SQL Server数据工具用于开发Integration Services,Analysis Services和SSRS报表服务器项目。

创建共享数据源 (Create a Shared Data Source)

Launch Visual Studio 2017, click New, click Project and then select Report Server Project

启动Visual Studio 2017,单击新建,单击项目 ,然后选择报表服务器项目

Right click the Shared Data Sources in the Solution Explorer panel

右键单击“解决方案资源管理器”面板中的共享数据源

Click Edit and fill the connection string fields.

单击编辑,然后填写连接字符串字段。

Click the Test Connection before to use data source because it helps us to test connection string settings.

单击之前的“ 测试连接”以使用数据源,因为它有助于我们测试连接字符串设置。

After these completed steps; we can deploy the report project to the report server. But before the deployment process we have to change some settings of deployment in the report server projects.

完成这些步骤后; 我们可以将报告项目部署到报告服务器。 但是在部署过程之前,我们必须更改报表服务器项目中的某些部署设置。

Right click report server project and select properties.

右键单击报表服务器项目,然后选择属性。

TargetDataSetFolder: This option specifies the target dataset folder in the report server.

TargetDataSetFolder :此选项指定报表服务器中的目标数据集文件夹。

TargetDataSourceFolder: This option specifies the target data source folder in the report server.

TargetDataSourceFolder :此选项指定报表服务器中的目标数据源文件夹。

TargetReportFolder: This option defines the reports folder in the report server.

TargetReportFolder :此选项定义报表服务器中的报表文件夹。

Overwrite DataSources: This option defines the enable or disable option to overwrite the old data source which was placed in the same data source folder and as the same data source name. If you set this option as false and when you try to deploy to the same data source folder and also the same data source name, the deployment process returns error. The error will look like the below image.

覆盖 数据源 :此选项定义启用或禁用选项,以覆盖放置在相同数据源文件夹中且具有相同数据源名称的旧数据源。 如果将此选项设置为false,并且当您尝试部署到相同的数据源文件夹和相同的数据源名称时,部署过程将返回错误。 该错误将如下图所示。

OverwriteDataSets: This option defines the enable or disable option to overwrite old datasets which were placed in the same dataset folder and as the same data source name

OverwriteDataSets :此选项定义启用或禁用选项,以覆盖放置在同一数据集文件夹中且具有相同数据源名称的旧数据集

TargetServerUrl: This option helps us to set target report server URL in which we will make the dataset, data source and report deployment. We can find this URL in the Web Service URL configuration settings.

TargetServerUrl :此选项可帮助我们设置目标报表服务器URL,在该URL中进行数据集,数据源和报表部署。 我们可以在Web服务URL配置设置中找到此URL。

TargetServerVersion: This option allows us to deploy report project to previous version of SQL Server Reporting Service. You need to be aware of all features which support your target SSRS version. Otherwise the deployment process will fail because of unsupported features and you will face this type of deployment error messages.

TargetServerVersion :此选项允许我们将报表项目部署到SQL Server Reporting Service的先前版本。 您需要了解支持目标SSRS版本的所有功能。 否则,部署过程将由于不支持的功能而失败,并且您将面临此类部署错误消息。

The reason of this error message is that the sunburst chart that is not supported by SSRS 2014 or earlier versions.

出现此错误消息的原因是SSRS 2014或更早版本不支持朝阳图 。

Now, we will make first deployment of our SSRS report project. Right click in report project and then select deploy.

现在,我们将首先部署SSRS报告项目。 右键单击报表项目,然后选择部署。

If the SSRS deployment is a success you will get an information message which looks like this in the output screen.

如果SSRS部署成功,您将在输出屏幕中看到一条信息消息,如下所示。

After this deployment; the shared data source will be created in the SSRS report server.

部署之后; 共享数据源将在SSRS报表服务器中创建。

创建共享数据源 (Create a Shared Data Source)

In the Solution Explorer, right click Shared Datasets and select Add New Dataset.

在解决方案资源管理器中,右键单击“ 共享数据集”,然后选择“ 添加新数据集”

You can copy/paste the query from which you want to retrieve data from data source. In this demonstration, we will use the following query in Adventureworks2014 sample database.

您可以复制/粘贴要从数据源中检索数据的查询。 在本演示中,我们将在Adventureworks2014示例数据库中使用以下查询。

SELECT soh.[SalesPersonID],p.[FirstName] + ' ' + COALESCE(p.[MiddleName], '') + ' ' + p.[LastName] AS [FullName],e.[JobTitle],st.[Name] AS [SalesTerritory],soh.[SubTotal],YEAR(DATEADD(m, 6, soh.[OrderDate])) AS [FiscalYear] FROM [Sales].[SalesPerson] sp INNER JOIN [Sales].[SalesOrderHeader] soh ON sp.[BusinessEntityID] = soh.[SalesPersonID]INNER JOIN [Sales].[SalesTerritory] st ON sp.[TerritoryID] = st.[TerritoryID] INNER JOIN [HumanResources].[Employee] e ON soh.[SalesPersonID] = e.[BusinessEntityID] INNER JOIN [Person].[Person] pON p.[BusinessEntityID] = sp.[BusinessEntityID]

We will re-deploy the SSRS report project and shared dataset placed into path which is defined in the report project property page. Our demo dataset will be placed into Home->Datasets path because we did not change the TargetDataSetFolder property and Visual Studio make deployment to default path. In the report server web portal, we will navigate to Home->Datasets folder and click manage in the SSRS shared data source; property tab will appear.

我们将重新部署SSRS报告项目,并将共享数据集放置在报告项目属性页面中定义的路径中。 我们的演示数据集将放置在Home-> Datasets路径中,因为我们没有更改TargetDataSetFolder属性,并且Visual Studio将部署设置为默认路径。 在报表服务器Web门户中,我们将导航到Home-> Datasets文件夹,然后单击SSRS共享数据源中的管理。 属性标签将出现。

In the Properties tab, we can edit, delete or change the folder of shared data source.

在“属性”选项卡中,我们可以编辑,删除或更改共享数据源的文件夹。

The Data Preview tab helps us to see a little part of data when we click Load Data.

单击“ 加载数据”时,“ 数据预览”选项卡可帮助我们查看一小部分数据

The Data sources tab allow us to change dataset of shared SSRS data source.

数据源选项卡允许我们更改共享SSRS数据源的数据集。

In the Dependent Items tab we can find reports, data-driven subscription or other objects which use this SSRS shared data source for retrieve data.

在“ 从属项”选项卡中,我们可以找到使用此SSRS共享数据源检索数据的报表,数据驱动的订阅或其他对象。

The Caching tab is a significant settings tab for SSRS shared datasets. In this tab we can enable or disable the caching mechanism for shared data source and at the same time we can determine the cache expiration time. And also we can create a schedule for cache expiration. Now, we will enable the caching and analyze the details of this option.

缓存选项卡是SSRS共享数据集的重要设置选项卡。 在此选项卡中,我们可以启用或禁用共享数据源的缓存机制,同时我们可以确定缓存的过期时间。 我们还可以为缓存过期创建时间表。 现在,我们将启用缓存并分析此选项的详细信息。

Check Cache copies of this dataset and use them when available and Cache expires after 30 Minutes options and then click the Apply button.

检查 此数据集的 缓存 副本,并在可用时使用它们,并且“ 缓存在 30分钟后失效 ”选项,然后单击“ 应用”按钮。

Now, we will click Load Data in the Data Preview tab two times with 1-minute gap. And then connect to the SSRS ReportServer database and execute the following query.

现在,我们将两次单击“ 数据预览”选项卡中的“ 加载数据” ,间隔为1分钟。 然后连接到SSRS ReportServer数据库并执行以下查询。

SELECT ItemPath,TimeStart ,TimeEnd , Source,Status,ByteCountFROM [dbo].[ExecutionLog3]where ItemPath LIKE '%SharedDataSetDemo%'
order by  TimeEnd desc

As you can see the above image; the first load data process connects to database and retrieves the recent result from SSRS target data source but the second report execution retrieves data from cache. The caching data is stored in ReportServerTempDB database. And the following query returns the details of cached data.

如上图所示: 第一个加载数据过程连接到数据库并从SSRS目标数据源检索最近的结果,但是第二个报告执行从高速缓存中检索数据。 缓存数据存储在ReportServerTempDB数据库中。 并且以下查询返回缓存数据的详细信息。

use ReportServerTempDB
select * from ExecutionCache
INNER JOIN ReportServer.dbo.Catalog Cat ON ExecutionCache.ReportID= Cat.ItemID

In this section we will explore the parameterized shared dataset behaviors with caching. Change the dataset query text like this.

在本节中,我们将探讨带缓存的参数化共享数据集行为。 像这样更改数据集查询文本。

SELECT soh.[SalesPersonID],p.[FirstName] + ' ' + COALESCE(p.[MiddleName], '') + ' ' + p.[LastName] AS [FullName],e.[JobTitle],st.[Name] AS [SalesTerritory],soh.[SubTotal],YEAR(DATEADD(m, 6, soh.[OrderDate])) AS [FiscalYear] FROM [Sales].[SalesPerson] sp INNER JOIN [Sales].[SalesOrderHeader] soh ON sp.[BusinessEntityID] = soh.[SalesPersonID]INNER JOIN [Sales].[SalesTerritory] st ON sp.[TerritoryID] = st.[TerritoryID] INNER JOIN [HumanResources].[Employee] e ON soh.[SalesPersonID] = e.[BusinessEntityID] INNER JOIN [Person].[Person] pON p.[BusinessEntityID] = sp.[BusinessEntityID]
where st.[Name] = @SalesTerritoryName

When click the shared dataset parameters tab, we can see the parameter which name is @SalesTerritoryName. We will re-deploy our report projects.

单击共享数据集参数选项卡时,我们可以看到名称为@SalesTerritoryName的参数。 我们将重新部署我们的报告项目。

We will create a dummy report for testing parameter caching. Right click Reports and select New item.

我们将创建一个虚拟报告以测试参数缓存。 右键单击“报告”,然后选择“ 新建项目”

Select Report object and click Add.

选择报告对象 ,然后单击添加

Right click in the DataSets folder which is located in the right side of report project. And select the SSRS shared dataset.

右键单击报表项目右侧的DataSets文件夹。 并选择SSRS共享数据集。

Click the Parameters folder and allow blank values for report parameter. Re-deploy the report project.

单击“ 参数”文件夹,并为报告参数允许使用空白值。 重新部署报告项目。

We will run the Dummyreport in this parameter order.

我们将按照此参数顺序运行Dummyreport。

1-France

1法国

2-Northeast

2东北

3-Canada

3-加拿大

4-France

4法国

5-france

5法郎

When we will run the below query in the SSRS ReportServer database and analyze the parameterized shared data source behaviors.

当我们将在SSRS ReportServer数据库中运行以下查询并分析参数化的共享数据源行为时。

SELECT top 5 ItemPath,TimeStart ,TimeEnd , Source,Status,ByteCount ,ParametersFROM [dbo].[ExecutionLog3]where ItemPath LIKE '%SharedDataSetDemo%'
order by  TimeEnd desc

The above image illustrates that SSRS uses the cache only for the same parameters and also it is case-sensitive to parameters.

上图说明SSRS仅将缓存用于相同的参数,并且对参数区分大小写。

I want to add some notes about undocumented details of SSRS caching. In some case maybe we required to clear shared data source cache. To perform this operation, we can use this stored procedure with path parameter.

我想添加一些有关未记录的SSRS缓存详细信息的注释。 在某些情况下,我们可能需要清除共享数据源缓存。 要执行此操作,我们可以将此存储过程与path参数一起使用。

EXECUTE FlushReportFromCache '/Datasets/SharedDataSetDemo'

翻译自: https://www.sqlshack.com/sql-server-reporting-services-ssrs-shared-dataset/

sql2012 ssrs

sql2012 ssrs_SQL Server Reporting Services(SSRS)共享数据集相关推荐

  1. 安装和配置SQL Server Reporting Services (SSRS)

    目录 什么是SQL Server报告服务(SSRS)? 先决条件 安装SQL Server报告服务(SSRS) 配置SQL Server报告服务 结论 在本文中,我们将在Windows机器上配置Mic ...

  2. python slicer_报表筛选:Excel Slicer与SQL Server Reporting Services(SSRS)参数

    python slicer This article explores the report filtering using Excel Slicer and SQL Server Reporting ...

  3. sql2012 ssrs_如何使用SQL Server Reporting Services(SSRS)增强报告

    sql2012 ssrs 介绍 (Introduction) A few months ago, I was working on a few SQL Server reports for a cli ...

  4. 如何使用SQL Server Reporting Services将数据格式转换为有价值的数据集

    介绍 ( Introduction ) Oft times we are forced into situations where we must clearly think outside of t ...

  5. 如何在SQL Server Reporting Services中使用表达式来创建有效的报告

    介绍 (Introduction) As many of you by now know, I am a fan of utilizing expressions within Reporting S ...

  6. 如何使用SQL Server Reporting Services创建图像分类系统

    介绍 (Introduction) With Christmas just around the corner, in today's "get together" I thoug ...

  7. 充分利用 SQL Server Reporting Services 图表

    最近在查SSRS的一些文章,看到MSDN在有一篇不错的文章,许多图表设置都有说明,共享给大家.. 其中有说明在SSRS中如果去写条件表达写和报表属性中的"自定义代码",文章相对比较 ...

  8. SQL Server Reporting Services最佳做法

    介绍 ( Introduction ) In past chats, we have had a look at a myriad of different business intelligence ...

  9. sql server 监视_使用SQL Server Reporting Services进行快速,肮脏的服务器监视

    sql server 监视 介绍 (Introduction) A few month back, I found myself in a position where the client want ...

最新文章

  1. 如何搭建亿级社交信息分享社交平台架构
  2. JAVA 继承和派生4.1-4.3 2020.3.20
  3. android 屏蔽home键操作
  4. SpringBoot单元测试运行时报错:Failed to load ApplicationContext
  5. CSS3伪类选择器:nth-child()(nth-child(odd)/nth-child(even))
  6. sum和total的区别
  7. oracle 之 基础操作
  8. iBATIS date MySQL_LocalDateTime与mysql日期类型的交互(基于mybatis)
  9. db2 导出换行_数据库 db2 换行符
  10. mysql 执行计划 视频_实战讲解MySQL执行计划,面试官当场要了我
  11. 5.数据中台 --- 数据汇聚联通:打破企业数据孤岛
  12. Java 加密扩展(JCE)框架 之 Cipher 加密与解密
  13. SVN提示: File or directory '*' is out of date; try updating 解决方案 .
  14. logback自定义日志配置
  15. 爬取贝壳网深圳二手房实战
  16. rabbitmq 406 错误
  17. c语言程序设计精髓 第14周练兵题
  18. 迅捷音频转换器如何转换音频教程
  19. 英国内政部(Home Office)间谍机构(spy powers)假装它是Ofcom咨询中的一名私人公民1525446049260...
  20. 《冰封王座》世界魔兽界十大叱咤风云人物

热门文章

  1. TripleDES加解密Java、C#、php通用代码
  2. JavaScript中的事件循环
  3. 【Flask-RESTPlus系列】Part2:响应编组
  4. 《鸟哥的Linux私房菜 基础学习篇(第四版)》 第23章 XWindows设定介绍 笔记
  5. 如何高效检查一个数组中是否包含某个值?
  6. OCR引擎-Tesseract
  7. 很口语I'll be back
  8. 玩转jquery插件之flexigrid 【转】
  9. C++---string类接口整理与深浅拷贝
  10. 【Vue】—Vue拆分文件