Quantcast
Viewing all articles
Browse latest Browse all 3160

SQL Server Reporting Services (SSRS) Shared Dataset

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.

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.

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.

Create a Shared Data Source

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


Image may be NSFW.
Clik here to view.
SQL Server Reporting Services (SSRS) Shared Dataset

Right click the Shared Data Sources in the Solution Explorer panel


Image may be NSFW.
Clik here to view.
SQL Server Reporting Services (SSRS) Shared Dataset

Click Edit and fill the connection string fields.


Image may be NSFW.
Clik here to view.
SQL Server Reporting Services (SSRS) Shared Dataset

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


Image may be NSFW.
Clik here to view.
SQL Server Reporting Services (SSRS) Shared Dataset

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.


Image may be NSFW.
Clik here to view.
SQL Server Reporting Services (SSRS) Shared Dataset

Image may be NSFW.
Clik here to view.
SQL Server Reporting Services (SSRS) Shared Dataset

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

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

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

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.


Image may be NSFW.
Clik here to view.
SQL Server Reporting Services (SSRS) Shared Dataset

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

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.

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.


Image may be NSFW.
Clik here to view.
SQL Server Reporting Services (SSRS) Shared Dataset

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

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


Image may be NSFW.
Clik here to view.
SQL Server Reporting Services (SSRS) Shared Dataset

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


Image may be NSFW.
Clik here to view.
SQL Server Reporting Services (SSRS) Shared Dataset

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


Image may be NSFW.
Clik here to view.
SQL Server Reporting Services (SSRS) Shared Dataset

Create a Shared Data Source

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


Image may be NSFW.
Clik here to view.
SQL Server Reporting Services (SSRS) Shared 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.

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] p ON p.[BusinessEntityID] = sp.[BusinessEntityID]
Image may be NSFW.
Clik here to view.
SQL Server Reporting Services (SSRS) Shared Dataset

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.


Image may be NSFW.
Clik here to view.
SQL Server Reporting Services (SSRS) Shared Dataset

In the Prope

Viewing all articles
Browse latest Browse all 3160

Trending Articles