Upload
thejaswi-shasthri
View
335
Download
4
Embed Size (px)
Citation preview
SQL Server Reporting Service
By,Thejaswi Shasthri
Introduction
● SQL Server Reporting Services(SSRS) is a reporting software application from
Microsoft.
● SSRS actually runs within Visual Studio, in an application called SSDT (SQL
Server Data Tools).
● SSRS Components:○ Report Server
○ Report Builder
○ Report Manager
○ VS integration via Report Viewer Control
SSRS Architecture
● The end user sends an HTTP request for a report, providing any required
parameters.
● The SSRS server finds the metadata of the report and sends a request for
data to the data sources.
● The data returned by the data sources is merged with the report definition
into a report.
● As the report is generated, it is returned to the client.
Figure
Working With SSRS
Report designer window
The main design window lets you to design and view the report itself.
Main Features of Report Designer
● The Datasets window shows the data that is available to the report.
● The main design window lets you view the report itself.
● The Solution Explorer, Output, and Properties windows are the standard
Visual Studio windows.
● You can change the available data or the sort order for the report by
modifying the query on the Data tab.
● You can resize or rearrange controls on the Layout tab.
Data SourceA shared data source is a data source that is common to, and can be used by, all of the reports in the project.
An embedded data source is a data source that is reserved for a particular report.
DatasetA dataset is the query definition.
Two types of query that can be used are,
○ Text○ Stored Procedures
Query designer gives a UI to design the query.
The report
At the top of the Report Designer window are two tabs: Design and Preview.
The Design tab is the physical Report Designer where we design the report i.e. set up the data presentation of the report itself, plus any header and footer for the report pages.
Best Practice
When creating a new report manually, we must always follow this sequence
of steps before we can begin to add data-connected objects:
1. Add the report
2. Create a data source in the report, preferably pointing to a shared data
source
3. Create a dataset that points to the data source and contains your query
Different Types of Reports
Tabular Reports
Tabular reports implies, just
simple data representation using
tables.
SSRS makes creating tabular
report super simple - just drag
and drop data elements.
It gives you the ability to add
totals etc, as we do in excel.
Parameterized Reports
A parameterized report uses input values to complete report or data processing. With a parameterized report, you can vary the output of a report based on values that are set when the report runs.
Parameterized reports are frequently used for drillthrough reports, linked reports, and subreports, connecting and filtering reports with related data.
Snapshot Reports
A report snapshot is a report that contains layout information and query results
that were retrieved at a specific point in time.
Report snapshots serve three purposes:
● Report history.
● Consistency.
● Performance.
● A cached report is a saved copy of a processed report.
● Cached reports are used to improve performance by reducing the number
of processing requests to the report processor and by reducing the time
required to retrieve large reports.
● They have a mandatory expiration period, usually in minutes.
Cached Reports
Linked Reports
● A linked report is a report server item that provides an access point to an
existing report.
● A linked report is derived from an existing report and retains the original's
report definition.
● A linked report always inherits report layout and data source properties of
the original report.
Drilldown Report
Drilldown reports initially hide
complexity and enable the user
to toggle conditionally hidden
report items to control how much
detail data they want to see.
Drilldown reports must retrieve
all possible data that can be
shown in the report.
For reports with large amounts of
data, consider drillthrough
reports instead.
Drillthrough Reports
● Drillthrough reports are standard reports that are accessed through a
hyperlink on a textbox in the original report.
● Drillthrough reports work with a main report and are the target of a
drillthrough action for a report item such as placeholder text or a chart.
● Drillthrough reports can be filtered by parameters, but they do not have to
be.
SubreportsA subreport is a report that
displays another report inside the
body of a main report. It is used
to embed a report within a report.
You can set up the parent report
to pass parameters to the
subreport.
For reports with many instances
of subreports, consider using
drillthrough reports instead.
Chart Types
Chart TypesIt is important to choose an
appropriate chart type for the
type of data that you are
presenting. This will determine
how well the data can be
interpreted when put in chart
form.
For example, if your dataset
contains a lot of data points
relative to the size of the chart, it
may be better presented using an
area, line, or scatter chart.
Choosing a Chart TypeChart type ratio data stock data linear data multi-value data
Area Charts (Report Builder and SSRS) yes
Bar Charts (Report Builder and SSRS) yes
Data Bars yes
Column Charts (Report Builder and SSRS) yes
Line Charts (Report Builder and SSRS) yes
Pie Charts (Report Builder and SSRS) yes
Polar Charts (Report Builder and SSRS) yes
Scatter Charts (Report Builder and SSRS) yes yes
Shape Charts (Report Builder and SSRS) yes
Sparklines yes yes yes yes
Report Level
PropertiesNow we have a basic, very plain,
tabular report, so let's add some
formatting to make it look better.
We have lots of options such as
adding background colors,
changing the font or text color,
adding italics or bolding, and
more. In this example, we will
change the background color of
the header row.
Report Parameters
There are two ways to add parameters to our reports. The first is simply to define parameters in the queries in the dataset, and then these will automatically be available as report parameters.
The second way is to manually add report parameters through the Parameters section of the Report Data window.
We can use parameters to filter the data at the source, or for other reasons like giving the end-user control over one of the properties. We could also have a parameter that is used for both functions.
Expressions
● Expressions are used frequently in reports to control content and report
appearance.
● Expressions are written in Microsoft Visual Basic, and can use built-in
functions, custom code, report and group variables, and user-defined
variables.
● Expressions begin with an equal sign (=).
● Learn more about expressions here https://msdn.microsoft.com/en-
us/library/ms157328.aspx
Creating Expression
You can create and modify report definition (.rdl) files in Report Builder and in Report Designer in SQL Server Data Tools.
Each authoring environment provides different ways to create, open, and save reports and related items.
Add Code to a Report
In any expression, you can call your own custom code. You can provide code in
the following two ways:
● Embed code written in Visual Basic directly in your report. If your code
refers to a Microsoft .NET Framework that is notSystem.Math or System.
Convert, you must add the reference to the report.
● Provide a custom code assembly by using the .NET Framework. If you
provide a custom assembly, you must install it on both the computer
where you author the report and the report server where you view the
report.
Cascaded Parameters
Cascading parameters provide a
way of managing large amounts
of report data.
With cascading parameters, the
list of values for one parameter
depends on the value chosen in
preceding parameter.
Order is important for cascading
parameters.
Document Map
A document map provides a set
of navigational links to report
items in a rendered report.
When you view a report that
includes a document map, a
separate side pane appears next
to the report.
Report subscriptions
● A report subscription is a report snapshot generated on some defined
scheduled time and delivered to the intended audience by the report
server.
● SSRS allows you to create two types of subscriptions, e.g., standard
subscriptions and data-driven subscription.
subscriptions in SQL Reporting
Services enable you to configure
the automatic delivery of
specified reports by e-mail or to a
file share at scheduled intervals.
You can also configure other
types of report subscriptions,
such as data-driven
subscriptions from the Web
interface included with Microsoft
SQL Server Reporting Services.
Subscriptions
Report Server
● A report server is a stateless server that uses the SQL Server Database
Engine to store metadata and object definitions.
● A native mode Reporting Services installation uses two databases to
separate persistent data storage from temporary storage requirements.
● The databases are created together and bound by name. By default, the
database names are reportserver and reportservertempdb, respectively.
Report Server Database● The report server database is a SQL Server database that stores the
following content:
○ Items managed by a report server (reports and linked reports, shared data sources, report
models, folders, resources) and all of the properties and security settings that are
associated with those items.
○ Subscription and schedule definitions.
○ Report snapshots (which include query results) and report history.
○ System properties and system-level security settings.
○ Report execution log data.
○ Symmetric keys and encrypted connection and credentials for report data sources.
● Because the report server database stores application state and persistent
data, you should create a backup schedule for this database to prevent
data loss.
Security and permissions● Reporting Services uses roles and role assignments to control access to
report server content. By creating role assignments, you enable other users
in your organization to view and publish reports and other items on a
report server.
● Security consists of two main components: security and access at the Report Server level and authentication and permission at the data source level.
● Providing access to reports is very simple and can be done at an item level( report level) or a folder level.
Roles● There are mainly 5 types of roles, that you can assign to an user or a
group.
● These roles are:
○ Browser: Allows users to run reports and browse folders; this role will be used by most end
users.
○ Content Manager: allows users to manage and define folders and reports and to grant
permissions.
○ Report Builder: Allows users to create Report Builder reports.
○ Publisher: Allows users to deploy / upload reports and create folders.
○ My Reports: Allows users to create and maintain personal MyReports folders.
Configuration Files
● Reporting Services stores component information in the registry and in
configuration files that are copied to the file system during setup.
● Configuration files contain a combination of internal-use-only and user-
defined values.
● User-defined values are specified through Setup, the configuration tools,
the command line utilities, and by manually editing the configuration files.
● RsReportServer.config file stores settings that are used by Report
Manager, the Report Server Web service, and background processing.
Reporting Services includes a
variety of configuration files.
There is a Web.config file for
each of the two ASP.NET
applications included with
Reporting Services.
The Web.config files contain
settings that are typically found
in files of this type. Additional
application-specific
configuration settings are stored
in component configuration files
described in the table.
File Description
\ReportManager\Web.config Report Manager Web.config file
\ReportServer\Web.configReport Server Web.config file
ReportingServicesService.exe.config Stores configuration settings used by the Report Server service.
RSMgrPolicy.config, RSPreviewPolicy.config, RSSrvPolicy.config
Stores component security policy information.
RSReportDesigner.config Stores configuration settings used by Report Designer.
RSReportServer.config Stores configuration settings used by the report server engine.
RSWebApplication.config Stores configuration settings used by Report Manager.
Deployment
● After you have designed and tested a report or set of reports, you can use
the built-in deployment features in SQL Server Data Tools (SSDT) to
publish the reports to a report server.
● You can publish a single report or a Report Server project that contains
multiple reports.
● Reports are built before they are published to ensure that only valid report
definitions are published to the report server.
Two ways of publishing a report
● Publishing a Single Report
○ If you do not want to publish all reports in a project, you can chose to publish only a single
report.
○ The target server URL of the report server must be specified and you might want to change
the default folders to which reports and shared data sources deploy.
● Publishing Multiple Reports
○ When you publish a Report Server project, you publish all reports in that project. All reports
are deployed using the same project configuration: to the same report server, the same
folder on the server, and so on.
○ A solution can include multiple Report Server projects, and using multiple project might
make it easier to manage the deployment of reports because you can use a different
configuration to deploy different projects.
Thank You