Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / SQL

Basics of SSRS

4.20/5 (5 votes)
28 Nov 2011CPOL3 min read 52.6K  
Basics of SSRS (Microsoft SQL Server Reporting Services)

Introduction

In this article, I will discuss how to work with SSRS, i.e., reporting services provided by Microsoft.

In this, we take look at the following items step by step:

  1. Basic & Standard Definition of SSRS (SQL Server Reporting Services)
  2. Download Adventure Work Sample DB to work with reporting services
  3. Develop reports using Business Intelligence

Note: Prior to working on this sample, one should have installed Reporting services & configure reporting services and this article is developed using Microsoft SQL Server 2008, VS 2008 (Business Intelligence).

Basic & Standard Definition of SSRS (SQL Server Reporting Services)

  1. SQL Server Reporting Services (SSRS) is a server-based report generation software system from Microsoft.
  2. It can be used to prepare and deliver a variety of interactive and printed reports. It is administered via a web interface.
  3. Reports are defined in Report Definition Language (RDL), an XML markup language.
  4. Reports can be designed using recent versions of Microsoft Visual Studio, with the included Business Intelligence Projects plug-in installed or with the included Report Builder, a simplified tool that does not offer all the functionality of Visual Studio. Reports defined by RDL can be generated in a variety of formats[1] including Excel, PDF, CSV, XML, TIFF (and other image formats[2]), and HTML Web Archive. SQL Server 2008 SSRS can also prepare reports in Microsoft Word (DOC) format.

Download Adventure Work Sample DB to work with reporting services:

  1. Download Adventure work DB from the below link:
    http://msftdbprodsamples.codeplex.com/releases/view/4004 
  2. Install downloaded DB.
  3. Open Microsoft SQL Management Studio & connect to database.
  4. Right click Database option & click Attach option as shown below:

    Image 1

  5. Click on Add button and navigate to the path where Adventure DB is installed and select AdventureWorks_Data.mdf as shown below:

    Image 2

  6. Finally, you should be seeing Adventure DB in the DB list as shown. Note if you have installed Reporting Services properly, you should be seeing ReportServer DB in the DB list as shown below. In my case, I have provided SSRS database names as ReportServer_DB, ReportServer_DBTempDB while configuring SSRS.

    Image 3

Develop Reports using Business Intelligence

  1. Open VS 2008, New Project, Business Intelligence Project, Report Server Project & name it as “ReportPrj”.

    Image 4

  2. Now it will show up the below screen, click next.

    Image 5

  3. Now select New Data Source, Name: Adventure, Type: Microsoft SQL Server & click Edit button.

    Image 6

  4. Select Servername, appropriate Authentication & select database as “AdventureWorks”, click Test Connection. If everything is properly selected, Test connection would get succeeded as shown below:

    Image 7

  5. Click ok. In connection string text area, db connection string would show up. Click Next.

    Image 8

  6. Now enter the below query in the query string text area & click next button:
    SQL
    Select top 150 * from Sales.SalesOrderHeader 
  7. Select tabular format, click next.

    Image 9

  8. Select fields from available fields area & click Details button, click next button.

    Image 10

  9. Now you can select table styles.

    Image 11

  10. Now it asks for report name, let's name it as FirstReport & click Finish button.

    Image 12

  11. This would generate report “FirtReport.rdl” with two tabs in it. The tabs are “Design”, “Preview”.
  12. To change the color of a column in a report, go to design tab, select Header cell or Row cell, go to Properties tab & select appropriate color.

    Image 13

  13. To view the data, go to Preview tab & look at the data.
  14. To change or modify query.
    1. Select Design tab, now go to menu items select View, select Report data.

      Image 14

    2. Right click Dataset1 under Adventure, select dataset properties.

      Image 15

    3. Change query or other properties as per your need.

      Image 16

  15. Finally right in solution explorer, click on solution & select deploy.

    Image 17

  16. After successful deployment, go to browser & open the reporting service URL. In my case, it is http://localhost/reportserver.
  17. Now you should be able to see the data.

Happy coding… hope this helps!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)