Quick introduction SQL Server Reporting Services (SSRS) 2008

Version : 0.5
Date : 31/07/2012
By : Albert van der Sel
For who : For anyone who likes to start using SSRS. But it is so "super simple", that it can only be effective for true starters.
Note : Refresh your browser to see updates.
Level : User Level.


Contents:

1. Introduction
2. A few remarks on installing and configuring SSRS
3. Creating and Deploying a Report using BIDS
4. Other ways to Create and Deploy a Report
5. A few remarks about the Security involved with Reports and SSRS.
6. A note on SSRS and High Availability


1. Introduction.

Working with SSRS can not only be of use for developers, but for DBA's as well. The "products" of SSRS, that is the reports, are generally
destined for true endusers.
SSRS is actually a "framework" with a number of components. Let's first take a look at SSRS of SQL 2008.

As a very logical introduction, you might picture a SQL Server database, and a certain "query" that delivers interesting information to endusers.
Now, working directly with TSQL is not really "great" for true endusers. Also, performance (and security) might be at risk as well.

And, even more true, end users often want "summaries" of data, in a nice and readble report. It's not always very trivial to realize that
by using TSQL alone.

A solution is SSRS. The SSRS framework provides for services, interfaces, representations of datasources, and a "Development Studio"
which enables you to create a clear and formatted report on the query, and when finished, to "deploy" it on the Report Server,
where it can simply be accessed by endusers using a webinterface.

Although SQL Server tables are the most logical foundation for datasources, you can choose others as well, like Oracle, or XML etc..

Thanks to the framework, the DBA can deploy reports, and also perform administrative tasks on them.

SSRS can be seen as a part of a Business Intelligence (BI) solution. A very important tool that comes with SSRS
is a "Development Environment" called "Business Intelligence Development Studio" (BIDS).

With BIDS, you could create relatively simple Reports and deploy them, but you could also perform more complicated stuff.
As an example of the latter: Suppose you first create "ETL like" code, which in Microsoft language often means that you
create socalled "SSIS packages" which may load data from (possibly) heterogene sources (other SQL Server systems, or legacy systems, access etc..)
into SQL Server tables first, and when that is done, generate a report on that data.

This can all be arranged from BIDS. It means that you can create "tasks" and workflows, which, when completed, in the end generates a "report".
In Microsoft language, you will always start with creating a "solution". A "solution" can be a simple as the generation
of a "Report" based on a query. Or, the solution can consists of a number of tasks (or projects) where for example one task (project)
can be the loading of SQL Server tables (through ETL/SSIS) from heterogenous sources, and the next step then might be the generation
of the report.

A birds-eye view on the architecture of SSRS is represented by the following figure:

Fig 1. Birds-eye view on the architecture of SSRS


It's a simple figure, but take notice of the different components. We will see them later on.
Note that SSRS needs two SQL Server databases (ReportServer and ReportServerTEMPDB), to store reportdata as well as metadata.

- In SSRS 2005, the Reporting Service was dependent on IIS (Internet Information Server).
So, in 2005, IIS was a required feature for installing and running SSRS on a Node.

- In SSRS 2008, the Reporting Service just uses the integrated "http.sys" webmodule,
thereby lifting the need for a full IIS installation.




2. A few remarks on installing and configuring SSRS.

2.1 A few remarks on installing SSRS.

Installing SSRS is an optional part of SQL Server setup.
Once your system have passed the "setup support rules" during the first stage of SQL Server setup, the installation is easy enough.
But a few remarks are in order.

⇒ 2.1.1. Selecting features to install:

Fig 2. Selecting the features to install:


During setup, you will see the screen above, as shown in figure 2. This screen shows you all the components you can install.
If you want SSRS to be installed on this machine, make sure you have selected
the "Report Service" in the Instance Features Note that you do not need to install SQL Server (Database Engine) and SSRS on the same machine.
So that's why you can select/deselect the checkboxes the it serves you best.
Although in many case, a lot of folks will install the SQL Server service (Database Engine) and SSRS, on the same node.
In this case, both checkboxes must be selected.
Note from figure 1, that SSRS needs two SQL Server databases for data and metadata storage (ReportServer and ReportServerTEMPDB).
So, if SQL Server is installed alongside SSRS on the same machine, both databases will be created autmatically
on the local SQL Server instance. Then there is no further followup needed. After setup, you can start using SSRS right away.

However, if you only install SSRS (and not the Database Engine) on some node, you need to perform some
configuration afterwards (like selecting a local or remote SQL Server for storing the ReportServer databases).

Also, make sure that you have selected the "Business Intelligence Development Studio" (BIDS) in the "shared features" section.


⇒ 2.1.2 Report Services Configuration during setup:

Fig 3. Report Services Configuration during setup:


After selecting the features and some other screens, the "Report Services Configuration" screen will popup, as shown
in figure 3.

- The "default" (install native mode default configuration) is ok, if you install the Database Engine, and SSRS
together on the same node, and you have the intention to deploy reports to SSRS in native mode (and not, for example, to Sharepoint right now)
If so, you do not to change anything, and after setup has finished, you can immediately create and deploy reports.

- If you install SSRS standallone (no SQL Server Database Engine on that same node), you must choose the third option.
Then, the service and all supporting files will be in installed.
Afterward, you need to use the "Reporting Services Configuration Manager" to make configurations, like selecting any
local or remote SQL Server instance, to install the Reporting databases onto.

- The second option (Sharepoint integration mode) might be used if you have the intention to integrate SSRS and Sharepoint.
Afterwards, the Sharepoint Admin needs to use Central Administration to create a Reporting Services service application.
Actually, during this process, three Reporting related databases will be created (instead of just two).

Notes:

(1) Since Sharepoint needs a SQL Server instance anyway for supporting the apps (like Content databases, Config databases etc..),
at such a SQL Server instance, you may then find these three additional SSRS databases like:

-ReportingService_90a9f15075522f22953c9a77e4a9f150
-ReportingService_90a9f15075522f22953c9a77e4a9f150TempDB
-ReportingService_90a9f15075522f22953c9a77e4a9f150_Alerting


However, in many cases, options 1 or 3, often apply.


⇒ 2.1.3. Automated (unattended) install:

If you want to install SSRS in the default way (option 1 in figure 3), then it is implied that the SQL Server Database Engine
is installed as well.
For such a configuration, it's not too hard to create an unattended scripted setup. It should resemble the example below:

C:\sql2k8x64> setup /q /ACTION=install /FEATURES=SQL,RS,TOOLS /INSTANCENAME=MSSQLSERVER /SQLSYSADMINACCOUNTS="BUILTIN\ADMINISTRATORS"
/RSSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE" /SQLSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE" /AGTSVCACCOUNT="NT AUTHORITY\NETWORK
SERVICE" /RSSVCSTARTUPTYPE="Manual" /RSINSTALLMODE="DefaultNativeMode"


2.2 A few remarks on configuring SSRS

One common way to configure SSRS, is to use the "Reporting Services Configuration Manager".
From the "SQL Server 2008" program group in the Windows startmenu, you can locate this tool in the "configuration" folder.

Fig 4. Locating the Report Services Configuration Manager:



Note: On my Server, the exe to this the tool is: "C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\RSConfigTool.exe"
If we start it, we see that there are indeed many configurable items that we can initiate from this tool.

In the example below, I have selected the "Databases" catagory in the left pane.
This could have been a valid option, if I had installed SSRS with "files only", using the third option (as shown in figure 3).

Fig 5. Report Services Configuration Manager:





3. Creating and Deploying a Report using BIDS.

This is really nice. If you have not created, and deployed, a report with SSRS and BIDS before,
then I am quite sure you are going to like this.

3.1 Make a few testtables and inserts some records (just "teststuff" to build reports on)

I am sure you have a SQL Server test/play database somewhere. In that database, create the three tables as
shown below, and insert the datarecords. The reason is, that we need some sample data to create reports on.
It's a silly datamodel, but we just need some testdata.
You can simply copy/paste the sql below in a Query Window.

Sample data:

create table CUSTOMERS
(
cust_id int primary key,
cust_name varchar(32),
cust_country varchar(32)
)

create table PRODUCTS
(
product_id int primary key,
product_name varchar(32)
)

create table SALES
(
product_id int foreign key references products(product_id),
cust_id int foreign key references customers(cust_id),
amount_sold int
)

insert into CUSTOMERS values (1, 'KLM','Netherlands')
insert into CUSTOMERS values (2, 'Shell','England')
insert into CUSTOMERS values (3, 'Kaputt AG','Germany')
insert into CUSTOMERS values (4, 'ABCcorp','USA')
insert into CUSTOMERS values (5, 'XYZcorp','USA')
insert into CUSTOMERS values (6, 'DEFcorp','USA')

insert into Products values (1, 'streetbike')
insert into Products values (2, 'offroadbike')
insert into Products values (3, 'handy crate of TNT per 20 kg')
insert into Products values (4, '5GW Powerplant')
insert into Products values (5, 'rollerskates')

insert into SALES values (1,1,50)
insert into SALES values (5,2,10)
insert into SALES values (3,3,25)
insert into SALES values (3,3,15)
insert into SALES values (1,4,15)
insert into SALES values (1,4,15)
insert into SALES values (1,4,15)
insert into SALES values (1,4,25)
insert into SALES values (4,3,7)
insert into SALES values (2,4,66)
insert into SALES values (1,1,50)
insert into SALES values (1,1,50)
insert into SALES values (1,1,100)
insert into SALES values (1,1,50)
insert into SALES values (5,1,17)
insert into SALES values (3,4,35)
insert into SALES values (3,2,25)




3.2 Create and Deploy a Report with BIDS

3.2.1 Starting a Solution or Project:

Before we make reports, I created a folder "C:\testreports" to hold all my new sources. Maybe you should do the same.
Now that all preparations are done, let's start creating a Report.

In your Windows SQL Server program group, locate the "SQL Server Business Intelligence Development Studio", and start it up.
Since we are going to create a new report, click on "File", click "New", and choose "Project"

Fig 6. Choosing for "Business Intelligence Projects"


Now watch the above dialogbox closely. Here, in the leftpane, we can choose for "Business Intelligence Projects" and "Other Projects Types"
Let's first try "Business Intelligence Projects". In the rightpane we can choose for "Report Server Project Wizard"
or "Report Server Project".
Both will lead to screens in order to create a Report, but the Wizard helps tremendously if you are new.
Now you could fill in "name" (TheFirstReport) and "location" (c:\testreports), and we could start.
But I want you to start a bit differently.

Instead, in the leftpane, choose "Other Project Types" and then choose "Visual Studio Solution", and choose "Blank Solution".

Fig 7. Choosing for "Solution"



Since the terms "solution" and "project" are names for "containers" which can hold items (such as a "report"),
there meaning in BIDS are very close (or almost identical). However, generally, a "solution" is a bit "wider" concept.
Anyway, for our goal to create reports we can choose the way like shown in fig 6, or like in fig. 7.

I like to start as shown in figure 7, so please choose that way too, and fill in the "Name" and "Location" exactly as shown:

Name: TheFirstSolution
Location: c:\testreports

After you have typed in the above, confirm your choice and click "OK".
At the right side of BITS, you will see the "Solution Explorer". Here it will show "Solution 'TheFirstSolution' (0 projects)"
Were gonna add a Project to our solution, so rightclick your solution and choose "Add" and choose "New Project".

Fig 8. Adding a Project to our "Solution"


The following will appear:

Fig 9. Adding a Project to our "Solution"



Fill in the Projectname as shown above (TheFirstReport) and click OK.
The solution explorer has changed to:

Fig 10. Solution Explorer showing "SharedDataSources" and "Reports". I already rightclicked on DataSources.



3.2.2 Add a Shared Data Source:

Since a Report is build on "data", we must create a "DataSource" first. A DataSource could be an Oracle database,
or TerraData, XML etc.., and ofcourse a SQL Server database as well.
So, rightclick the "Shared Data Sources" container, and choose "Add New Data Source".


Fig 11. Shared Data Source Properties.



Give the Data Source an appropriate name. I named it "SQLServerTESTDB".
In order to create a "connection string" (on how the report will access the database), click "Edit".

Fig 12.



Select the desired SQL Server Instance name, and after that, select the desired Database name.
In my case, the instance is called "WSWIN7", and the database containing the sample data is "TEST".
Click OK to return to the former Dialogbox. Take notice of the "connection string". Apparently, a Database is called a "Catalog".
Confirm this Dialogbox too, and in the Solution Explorer you will see your Data Source listed as "SQLServerTESTDB.rds".


3.2.3 Add a Report:

Finally, we are going to create a Report. Rightclick the Reports container. Note that we have two relevant choices here:

- Add New Report (this will start a Wizard)
- Add -> New Item (create the Report in "do it yourself" mode: no Wizard)

Here, we take the Wizard, so choose "Add New Report". The "Welcome To The Report Wizard" screen pops up. Click Next.

In the Dialogbox that follows (not shown here), you can either select an existing DataSource, or create a new one.
Since we already have the correct DataSource, we only need to to click "Next".

Note: indeed, a "solution" or "project" might have multiple "DataSources", so this is why you were able
to select an existing DataSource, or create a new one.

Next follows the "Query Builder" screen. Here you have some choices. You might enter a "stored procedure" that
retrieves the Report data, or you may enter a Query (what I did), or you can graphically build a Query by
clicking on "Query Builder".
I simply added a Query as shown in the figure below.

By the way, here is the query in text:
select CUSTOMERS.cust_name, Products.product_name, SUM(SALES.amount_sold) Total_Amount
from CUSTOMERS inner join SALES on CUSTOMERS.cust_id=SALES.cust_id
inner join PRODUCTS on Products.product_id=SALES.product_id
group by CUSTOMERS.cust_name, Products.product_name


Fig 13. Add a Query



After that, a few dialogboxes will follow with respect to the "formatting" of the Report.
I think that this is not so very important for this note. However, one of those screens is shown below.
In this particular screen you decide on how you "group" the records. Here is where a general knowledge
of SQL queries might help (like how to group data).


Fig 15. Design the Report



Now some other dialogboxes will follow with respect to formatting. Choose what you like, or just
take the defaults. However, there is one screen where you can select
"Enable Drill Down" and "Include Subtotals". I would like you to enable those.

After a while, you are finished, and BIDS will look like this:

Fig 16. BIDS:



Take a good look at that screen. On the right is the Solution Explorer, showing the objects that you have created sofar.
In the middle we have your Report in two possible modes (note the tabs): Design and Preview.
If you switch to "Preview" mode, the report will be build and you will see what your endusers will see as well.
In "Design" mode, you can still alter details of your report (like for example widening a column).


3.2.4 What files do we have up to now?:

Since I stored everything in C:\testreports, let's see what we have in there.
You might find several directories and files, among which there should be:

-There is a .sln file, which describes versions of the "solution"
-We have a .rdl file, which describes the "report" in XML
-And we have .rds file which describes the DataSource

In BIDS, in the Solution Explorer, you can rightclick Report1, and choose "View Code" which shows you the XML.


3.2.5 Deploy the Report using BIDS:

Now we need to deploy the report on the Reporting Services, so that endusers may access it using a browser.
Don't forget: BIDS is a client tool, so maybe you have developed the report on your Workstation.
When we deploy, the ReportServer database receives the neccessary information about the DataSource, Report etc..
so that this information is centrally accessible.

If you take a look at the figure below, then you see how you can deploy your solution.
But hold on: BIDS first need some info from you like the Server URL.

Fig 17. To Deploy a Solution/Report using BIDS:



So before you take action like is suggested in figure 17, rightclick your solution and choose "Properties".
In figure 18 you see an example of those properties and values.
Take a good look at those properties. The server URL, in my case "http://wswin7/reportserver" is essential.


Fig 18. Viewing properties before deploying:



When all properties are set, perform the action as is suggested in figure 17.

Note: when you performed all of the above on a Vista/Win7 workstation with SQL Server and SSRS installed,
then you might receive an error on "insufficient permissions", even if you were logged on as an Administrative user.
In this case, startup BIDS again, but this time using the "run as Administrator" (rightclick the icon).

To view your report, use: http://YourReportServer/reports

In my case, I would see this:

Fig 19. Accessing the Report using a browser:



As shown above, I can click the "TheFirstReport", and from there I am able to really active the report with data.

Fig 20. Viewing the Report from client browser:





4. Some other ways to Create and Deploy a Report.

In deploying Reports accross Development, Test, Acceptance and Production systems, it is absolutely essential
that you keep (for example) DataSource names consistent accross all environments.
Generally it is not difficult to deploy reports. The problem often is, to have a good consistent strategy
for deploying reports from Test to Acceptance to Production.

Never underestimate this: it requires carefull planning and probably quite some research.

Here are just a few "hints" on how you can deploy reports:

1. Using BIDS:

This is what we already have seen in the above section.


2. Using "rs.exe" command prompt utility:

You can deploy reports using the "rs.exe" command utility.
Here is an example:

C:\SSRSscrips> rs –i Script.rss -s http://servername/reportserver

You can easily check the internet for the full syntax of "rs" and examples of deployment.


3. Using the Report Manager:

You can access the Report manager for managing and viewing reports. Use the following URL:

http://YourReportServer/reportserver

Here you will find controls to upload a file. To upload a report, browse to a report definition (.rdl) file.
See also section 3.2.4.

Fig 21. Upload a report .rdl file:





5. Security involved with Reports and SSRS.

Here are a few words on managing security around published Reports.

SSRS 2008 does not use Internet Information Server (IIS) to "host" the folders as "virtual directories".
SSRS sort of hosts them itself using http.sys and database information (as we shall see later).
This somewhat complicates "good" management of virtual directories.

As we know we can connect to the folders and modify the permissions using the Report manager. What type of "permissions"
you can "grant" to Domain groups (or users), are determined by the implicit "roles" within the Report Services itself.
This will be explained now.

1. Roles in Report Services:

Just as with the SQL Server engine, where predefined database roles exists (like db_datareader etc..), the same paradigm
is in place with the Report Service engine.

From SQLServer Management Studio (SSMS), you not only can connect to SQL Server instances, but to "Analysis Services" and
and "Report Services" as well.
In the figure below, I connected to my Report Server (using SSMS) and viewed which roles exists.
As you can see, various roles exists, like "Browser" and "Content Manager" etc.., each with a predefined list
of "permitted tasks" aka permissions.
I doubleclicked the Content Manager role, which role may perform just about any task as you can see from figure 22.
By the way, it's possible to select/deselect a certain task (permission) in order to "lower" or "increase"
the role's power

Fig 22. Roles in Report Server:




Note that it's easy to create a custom role. Just rightclick the Roles container and choose "Add Role"
As you can see in the figure above, I created the role "ThisRoleWasCreatedByAlbert" which may only view reports.


2. Managing Folders and Reports in Report Manager:

You can start the Report Manager (which is a webinterface) using the URL http://YourReportServer/reports

Once you see the list of folders, you can manage the permissions around them. In the figure below, I indented
to "edit" the security of the "TheLastReport" folder. So, select that folder and click edit.

Fig 23. Granting permissions in Report Manager (webinterface):



So, I pursued my action, and tried to alter the "permissions" with respect to "TheLastReport".
As you can see, I can grant the group "Antapex\nerds" the role "ThisRoleWasCreatedByAlbert" to view reports.

Fig 24. Granting permissions in Report Manager:





3. Registrations in the ReportServer database:

In the ReportServer database, a number of tables exists which form "the registry" around SSRS.
As you can see in the figure below, the folders or virtual directories (like TheLastReport), are simply records
in the Catalog table.

Fig 25. Metadata in the ReportServer database:



So, multiple SSRS implementations in native mode, will never form an Enterprise System.
For Enterprise implementations, Sharepoint is a much better starting point, where SSRS is just simply a component
among many other components.




6. A note on SSRS and High Availability.

Reporting Services itself, is not cluster-aware. But you can let the underlying Report database(s) to be part of a HA solution,
like Database Mirroring or Failover Clustering.
But the SSRS instance itself, is not cluster aware and cannot failover, even if you install SSRS on two Failover clusternodes.

However, you might consider a SSRS scale-out deployment to run in a "Network Load Balancing cluster" (NLB).
This means that a "Load Balancer" "connects" to two (or more) SSRS instances, which uses a shared Reporting Database.
This Reporting database then, can just be part of a SQL Server Failover cluster.
In this case, the balancing also has an implicit HA functionality for the SSRS instances, while the database(s)
just ar part of standard Failover clustering.
It is very important to understand that the "Balancer" is just a "Virtual IP" in DNS, while the NLB cluster software is installed
and configured on the Servers where the SSRS instances are going to be installed.

So, the NLB cluster is accessible through a virtual server name that "maps" to the virtual server IP address (in DNS).
A virtual server name is needed so that you can configure a single point of entry to the NLB cluster.
The NLB cluster then will adress the balancing between the "real SSRS nodes".
When configuring a URL for each report server instance, you will specify the virtual server name as the host.





So..., this note..., was it not "Super Simple" ? Still, I hope it was usefull.....