Sunteți pe pagina 1din 11

SSRS

Sql Server Reporting Service is used to generate reports by taking input either from OLTP
database or OLAP Database.

To retrieve information from OLTP database we can Write SQL Query and to get the data
from OLAP cube we have to write MDX query.

We can develop reports by using 2 types of projects

1. Report Server Project Wizard

2. Report Server Project

Types of Reports:

In any case we can design the following types of reports

 Tabular Reports

 Matrix Reports

 List Reports

 Chart Reports

The following are the other type of reports that can be designed by the help of tabular /
matrix report

 DrillDown Report

 DrillThrough Report

 SubReport

Once we open any Report Server project we will find the following items in the solution explorer

 Shared Data Sources

 Shared DataSets

 Reports

Shared Data Sources contains list of datasources that are accessible to any report in the project.

Shared DataSets are the resultsets that are available for are the reports in the project

Reports contains list of reports in the project.


Creating a Report Server Wizard Project

1. Start a new Report Server Wizard project

2. In the window displayed click next button and follow these steps

3. In the Design Query Window write the following command


4. Select type of report as “Tabular”
5. Configure Report Wizard as follows

6. Choose table layout as “stepped”


7. Finish configuration by providing a name to the report. Ex: rptTabStepDemo.

Using Report Server Project


1. Start a new Report Server Project and name it as rsDemo
2. In the solution explorer window Right click on “Shared Data Sources” option and select “Add
New DataSource” option
3. Configure a datasource with name “dsAW” for ‘AdventureworksDW2012” database in the
local server
4. Right click on “Reports” and select “AddNew Item” option
5. Choose “Report” and provide a name to the report. Ex : rptTab.rdl
6. A blank report Designer will be opened where we can design the report by using “Report
Data” and “ToolBox” Tabs in the toolbox.
7. Report Deigner contains DataSources,DataSets
8. Toolbox Contains Controls to be placed on the report Designer.

9. Right click on “DataSources” in “Report Data” window and select “Add DataSource” option.
10. In the window Displayed choose “Use shared data source reference” and select “dsAW”.

11. Right click on “DataSets” in “Report Data” window and select “Add Dataset” option
12. In the window displayed choose “Use a dataset embedded in my report” option.
13. Choose datasource as “datasource1”
14. Choose “QueryType” as “Text”
15. Write the following query
SELECT DimProduct.EnglishProductName, DimProduct.Color, DimProduct.Class,
FactInternetSales.SalesAmount, FactInternetSales.TaxAmt
FROM DimProduct INNER JOIN
FactInternetSales ON DimProduct.ProductKey = FactInternetSales.ProductKey

16. Open the “ToolBox” window , Drag and drop a “Table” control on to the designer
17. Open “Report Data” Window, Drag and drop members from dataset on to the table

18. Click on “Preview” and see the report.

Using Expressions:
Expressions will be used in different scenarios to provide customized result.
In the previous report we will get output in plain report format.
In order to display the report output in the following way use expressions for background
color of the records to be displayed.

1. In the design tab select column header and set the background color property
2. Select the row properties window.
3. Click the drop down button of backcolor and choose expression link

4. Write the following expression


Creating Matrix Report:

1. Start a new Report Server Project and name it as rsDemo


2. In the solution explorer window Right click on “Shared Data Sources” option and select
“Add New DataSource” option
3. Configure a datasource with name “dsAW” for ‘AdventureworksDW2012” database in
the local server
4. Right click on “Reports” and select “AddNew Item” option
5. Choose “Report” and provide a name to the report. Ex : rptMatrix.rdl
6. A blank report Designer will be opened where we can design the report by using “Report
Data” and “ToolBox” Tabs in the toolbox.
7. Report Deigner contains DataSources,DataSets
8. Toolbox Contains Controls to be placed on the report Designer.
9. Right click on “DataSources” in “Report Data” window and select “Add DataSource”
option.
10. In the window Displayed choose “Use shared data source reference” and select “dsAW”.
11. Right click on “DataSets” in “Report Data” window and select “Add Dataset” option
12. In the window displayed choose “Use a dataset embedded in my report” option.
13. Choose datasource as “datasource1”
14. Choose “QueryType” as “Text”

15. Write the following query


SELECT DimProduct.EnglishProductName, DimProduct.Color, DimProduct.Class,
FactInternetSales.SalesAmount, FactInternetSales.TaxAmt
FROM DimProduct INNER JOIN
FactInternetSales ON DimProduct.ProductKey = FactInternetSales.ProductKey
16. Open the “ToolBox” window , Drag and drop a “Matrix” control on to the designer
17.

18. Open “Report Data” Window, Drag and drop class,color,English product name from
dataset on to the table rows. SalesAmount, TaxAmount into Data.
19. Right click Sales Amount Cell and choose “Split Cells” Option.

20. Specify Send cell as “Tax Amount” beside ‘Sales Amount’


21. Click on “Preview” to view the report.

Using Parameters :

The “Parameters” section in the Report Data window is used to configure parameters with
static values or values from a dataset. Based on these values we can pass parameters to the SQL
Statement or Procedre.
Creating a Parameter With Static Values :

1. In the report data window, right click on ‘Parameters’ and choose ‘Add Parameter’ option
2. In the window displayed specify Name and Prompt values .

3. Choose Available Values.


4. Select Specify values
5. Click Add button
6. Specify Label and values
5. Open dataset and change the command as follows:

SELECT DimProduct.EnglishProductName, DimProduct.Color, DimProduct.Class,


FactInternetSales.SalesAmount, FactInternetSales.TaxAmt
FROM DimProduct INNER JOIN
FactInternetSales ON DimProduct.ProductKey = FactInternetSales.ProductKey
where color in(@color)
6. Select ‘Parameters’ Tab and choose value for Color Parameter as ‘@colorParam’

7. Click privew and observe the filter at the top of the screen
8. Choose a color and click on ‘View Report’ button.

S-ar putea să vă placă și