Вы находитесь на странице: 1из 27

SQL Server Reporting Services

Reporting Services

Objectives

Data from a resource can be made useful only when they are processed as
required information. The processed data makes sense and serves its purpose
of analysis and others when it is presented in the form of a report. Reporting is
vital to all organizations. In this chapter you would learn some common forms of
reporting cultures.

By the end of this module you should be able to

Start with Report Services Model Project


Define Data Source
Create a new Report
Create New Data Set
Write T-SQL for designing Report
Preview the report

2
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
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
SQL Server Reporting Services

After the new project is created the following screen appears:

5
SQL Server Reporting Services

Defining Data Source

Defining a data source provides data to your report. In Reporting Services, 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.

6
SQL Server Reporting Services

Steps to define a data source:

Go to Solution explorer > Right click on the shared data sources > click add
new data source.

Enter the name.

Click Edit.

7
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 Server
Authentication.

Select the database from which you want the report to get its data.

Click Ok.

8
SQL Server Reporting Services

Click Ok.

9
SQL Server Reporting Services

Data source is added.

10
SQL Server Reporting Services

11
SQL Server Reporting Services

Creating a new Report


Go to Solution Explorer > right-click Reports > Add >click New Item.

In add new item screen select report.

Name the report.

Click Add.

12
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
SQL Server Reporting Services

The Data Source wizard appears.

Type the name (sales) of the query.

Select the data source.

Click Ok.

14
SQL Server Reporting Services

15
SQL Server Reporting Services

Writing T-SQL for the report


After 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
SQL Server Reporting Services

SELECT dbo.Products.ProductName, dbo. [Order Details]. Quantity,


dbo.Orders.OrderDate
FROM dbo.Products INNER JOIN
dbo.[Order Details] ON
dbo.Products.ProductID = dbo.[Order Details].ProductID
INNER JOIN dbo. Orders
ON dbo. [Order Details].OrderID = dbo.Orders.OrderID

Run

To run the query click run option.

17
SQL Server Reporting Services

Designing Report

Report Layout consists of tables, text boxes, images, and other items that you
want to incorporate in your report. You create a report layout by dragging and
dropping data regions and other report items on to the design surface in the
Layout tab.

18
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
SQL Server Reporting Services

Report Designer draws a table, with three columns.

20
SQL Server Reporting Services

Detail Row

Drag the field names from the Datasets window to the middle (detail) row of
the first column in the table.

21
SQL Server Reporting Services

Previewing the report


Previewing a report allows you to easily view the appearance of the report
without having to go through the extra steps of publishing it to a report server.

Steps to preview:
Select preview tab.

22
SQL Server Reporting Services

You can see the how the report appears.

23
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 <project name> properties

Now type http://keyskill/reportserver in the target URL option

Click OK

24
SQL Server Reporting Services

Goto build in the menu bar and select deploy

25
SQL Server Reporting Services

Now to see the reports deployed in the target URL, open Internet explorer and
type http://keyskill/reports

26
SQL Server Reporting Services

Click the required folders or files to see the reports in the explorer

Conclusion

27
SQL Server Reporting Services

Learnt how to-

Start with Report Services Model Project


Define Data Source
Create a New Report
Create New Data Set
Write T-SQL for designing Report
Preview the report

28

Вам также может понравиться