Download - 4-Reporting Services
-
8/7/2019 4-Reporting Services
1/27
SQL Server Reporting Services
Reporting Services
Objectives
Data from a resource can be made useful only when they are processed asrequired information. The processed data makes sense and serves its purposeof analysis and others when it is presented in the form of a report. Reporting isvital to all organizations. In this chapter you would learn some common forms ofreporting cultures.
By the end of this module you should be able to
Start with Report Services Model ProjectDefine Data SourceCreate a new ReportCreate New Data SetWrite T-SQL for designing Report
Preview the report
2
-
8/7/2019 4-Reporting Services
2/27
SQL Server Reporting Services
Introduction
SQL Server Reporting Services is a complete, server-based solution that enables
the creation, management, and delivery of both usual, paper-oriented reports
and interactive, Web-based reports.
Reporting Services includes all the development and management pieces
essential to publish end user reports in HTML, PDF and Excel
Starting with Report Services Model Project
Go to Start >Programs > SQL Server Business Development Studio.
3
-
8/7/2019 4-Reporting Services
3/27
SQL Server Reporting Services
A report server project is used to create reports that run on a report server.
Go to File menu >New > Project.
Select Report Server Project and name the project.
Click Ok.
4
-
8/7/2019 4-Reporting Services
4/27
SQL Server Reporting Services
After the new project is created the following screen appears:
5
-
8/7/2019 4-Reporting Services
5/27
SQL Server Reporting Services
Defining Data Source
Defining a data source provides data to your report. In Reporting Services, datathat you use in reports is contained in a dataset. A dataset includes a pointer toa data source and the query to be used by a report.
6
-
8/7/2019 4-Reporting Services
6/27
SQL Server Reporting Services
Steps to define a data source:
Go to Solution explorer > Right click on the shared data sources > click addnew data source.
Enter the name.
Click Edit.
7
-
8/7/2019 4-Reporting Services
7/27
SQL Server Reporting Services
Select Data Source as Microsoft Sql Server.
Select Keyskill as the server.
Enter your user-ID and password by choosing the radio button for SQL ServerAuthentication.
Select the database from which you want the report to get its data.
Click Ok.
8
-
8/7/2019 4-Reporting Services
8/27
SQL Server Reporting Services
Click Ok.
9
-
8/7/2019 4-Reporting Services
9/27
SQL Server Reporting Services
Data source is added.
10
-
8/7/2019 4-Reporting Services
10/27
SQL Server Reporting Services
11
-
8/7/2019 4-Reporting Services
11/27
SQL Server Reporting Services
Creating a new ReportGo to Solution Explorer > right-click Reports >Add >click New Item.
In add new item screen select report.
Name the report.
Click Add.
12
-
8/7/2019 4-Reporting Services
12/27
SQL Server Reporting Services
Creating New Data Set
Data that you use in reports is contained in a dataset. A dataset includes a
pointer to a data source and the query to be used by a report.
Steps to create new data set:
Go to Data tab > select Dataset drop-down list > select New Dataset.
13
-
8/7/2019 4-Reporting Services
13/27
SQL Server Reporting Services
The Data Source wizard appears.
Type the name (sales) of the query.
Select the data source.
Click Ok.
14
-
8/7/2019 4-Reporting Services
14/27
SQL Server Reporting Services
15
-
8/7/2019 4-Reporting Services
15/27
SQL Server Reporting Services
Writing T-SQL for the reportAfter a dataset is created it displays the query designer, which you can use to
design the query.
Steps to write a query for the report:
In the query designer type the following query (The query retrieves all the
product details related quantity based on date).
16
-
8/7/2019 4-Reporting Services
16/27
SQL Server Reporting Services
SELECT dbo.Products.ProductName, dbo. [Order Details]. Quantity,dbo.Orders.OrderDateFROM dbo.Products INNER JOIN
dbo.[Order Details] ON
dbo.Products.ProductID = dbo.[Order Details].ProductIDINNER JOIN dbo. OrdersON dbo. [Order Details].OrderID = dbo.Orders.OrderID
To run the query click run option.
17
Run
-
8/7/2019 4-Reporting Services
17/27
SQL Server Reporting Services
Designing Report
Report Layout consists of tables, text boxes, images, and other items that youwant to incorporate in your report. You create a report layout by dragging anddropping data regions and other report items on to the design surface in theLayout tab.
18
-
8/7/2019 4-Reporting Services
18/27
SQL Server Reporting Services
Steps to design a report:
Click Layout tab
Go to Toolbox >click Table> Drag and drop on to the design surface.
19
-
8/7/2019 4-Reporting Services
19/27
SQL Server Reporting Services
Report Designer draws a table, with three columns.
20
-
8/7/2019 4-Reporting Services
20/27
SQL Server Reporting Services
Drag the field names from the Datasets window to the middle (detail) row of
the first column in the table.
21
-
8/7/2019 4-Reporting Services
21/27
SQL Server Reporting Services
Previewing the reportPreviewing a report allows you to easily view the appearance of the reportwithout having to go through the extra steps of publishing it to a report server.
Steps to preview:Select preview tab.
22
-
8/7/2019 4-Reporting Services
22/27
SQL Server Reporting Services
You can see the how the report appears.
23
-
8/7/2019 4-Reporting Services
23/27
SQL Server Reporting Services
Created report successfully using Report Server Project
Deploying the report:
To deploy all the reports under your project follow the steps below
Goto project in the menu bar and select the properties
Now type http://keyskill/reportserver in the target URL option
Click OK
24
http://keyskill/reportserverhttp://keyskill/reportserver -
8/7/2019 4-Reporting Services
24/27
SQL Server Reporting Services
Goto build in the menu bar and select deploy
25
-
8/7/2019 4-Reporting Services
25/27
SQL Server Reporting Services
Now to see the reports deployed in the target URL, open Internet explorer andtype http://keyskill/reports
26
http://keyskill/reportshttp://keyskill/reports -
8/7/2019 4-Reporting Services
26/27
SQL Server Reporting Services
Click the required folders or files to see the reports in the explorer
Conclusion
27
-
8/7/2019 4-Reporting Services
27/27
SQL Server Reporting Services
Learnt how to-
Start with Report Services Model ProjectDefine Data SourceCreate a New Report
Create New Data SetWrite T-SQL for designing ReportPreview the report