0% found this document useful (0 votes)
8 views

SQL Server 2005 Reporting Services

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

SQL Server 2005 Reporting Services

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

SQL Server 2005

Reporting Services
Table of Contents
SQL Server 2005 Reporting Services............................................................................................................................3
Exercise 1 Creating a Report Using the Wizard ............................................................................................................4
Exercise 2 Creating a List Report..................................................................................................................................7
Exercise 3 Managing Security .....................................................................................................................................13
SQL Server 2005 Reporting Services

SQL Server 2005 Reporting Services


After completing this lab, you will be able to:
Objectives
1. Create a Report Using the Wizard
NOTE: This lab focuses on the
2. Create a List Report
concepts in this module and as a 3. Work with Reports
result may not comply with 4. Manage Security
Microsoft security
recommendations.

NOTE: The SQL Server 2005 labs


are based on beta builds of the
product. The intent of these labs is
to provide you with a general feel of
some of the planned features for
the next release of SQL Server. As
with all software development
projects, the final version may differ
from beta builds in both features
and user interface. For the latest
details on SQL Server 2005, please
visit
http://www.microsoft.com/sql/2005/.
Reporting Services is a key component in providing a complete
Scenario data management platform for SQL Server users. This lab will
teach you how to create different types of reports using Reporting
Services and the SQL Server Business Intelligence Workbench. It
also covers managing security settings for these reports and the
different deployment models available.
ƒ Basic working experience with the SQL Server Business
Prerequisites Intelligence Workbench
ƒ Basic knowledge of SQL Server security features
75 Minutes
Estimated Time to
Complete This Lab

Page 3 of 15
SQL Server 2005 Reporting Services

Exercise 1
Creating a Report Using the Wizard
Scenario
In this exercise, you will create a simple report using the Business Intelligence Development Studio.
To create the report, you will:
ƒ Create a Business Intelligence Development Studio solution and add a Report Project.
ƒ Create a tabular report using the Report Wizard.
SQL Reporting Services report designer is hosted in the Business Intelligence Development Studio environment. It
provides you with an integrated developer environment for designing, creating, testing, and debugging reports.

Tasks Detailed Steps


1. Copy the report query. a. Click in the virtual machine window.
b. Press Right-ALT + DEL.
c. Logon as Administrator with a password of pass@word1
Before creating a report, edit and copy a query using Notepad. This query will be
used to create a simple report.
d. Click Start | Run, and then type Notepad and click OK.
e. Select File | Open, navigate to the C:\SQL Labs\Lab Projects\Reporting
Services Lab directory, select Query.txt, and then click Open.
Using previously developed queries can save time when creating data sets. It also
allows users to develop queries using other tools, and then paste the SQL into this
interface.
f. In Notepad, select all the text by pressing Ctrl+A and then copy by using
Ctrl+C. Select File | Exit to exit Notepad without saving the document.
2. Launch the report a. From the Windows task bar, select Start | All Programs | Microsoft SQL
design environment. Server 2005 | Business Intelligence Development Studio.
Business Intelligence Development Studio provides the environment in which
Reporting Services reports are designed.
b. Select File | New | Project.
c. In the New Project dialog box, in the Project Types pane, verify that the
Business Intelligence Projects folder is selected.
Business Intelligence Development Studio allows you to create a blank Visual Studio
2005 solution or to select one of the Business Intelligence templates such as Analysis
NOTE: If the Solution Explorer Services Project, Integration Services Project, or Report Project.
pane is not visible, select
d. In the Templates pane, click the Report Project icon.
View | Solution Explorer.
e. In the Location text box, enter C:\SQL Labs\User Projects.
f. In the Name box, accept the default name (that is, Report Project1), and then
click OK.
3. Create a new report A new report can be created using the report wizard.
using the report a. Select Project | Add New Item.
wizard.
b. In the Add New Item page, from the Templates pane, select Report Wizard and
then click Add.
c. On the Welcome to the Report Wizard page, click Next.
d. On the Select the Data Source dialog box, select New data source. Make sure
that Microsoft SQL Server is selected in the Type drop-down list, and click the

Page 4 of 15
SQL Server 2005 Reporting Services

Tasks Detailed Steps


Edit button.
e. In the Data Link Properties dialog box, on the Connection tab, in the Data
Source text box, type localhost.
f. Under Enter information to log on to the server, select Use Windows NT
Integrated security.
g. In the Enter the initial catalog to use drop-down list, select
AdventureWorksDW, and then click OK.
h. Verify that the local server localhost and AdventureWorksDW database are
both listed in the connection string. Click Next.
i. In the Design the Query page, paste the text from the Notepad query in the
Query String text box by clicking the Query String box and pressing Ctrl+V.
j. At the end of the existing query, insert a new line, and then type:
Note: To enter a new line, it may be necessary to press Ctrl-ENTER.

WHERE EnglishProductCategoryName = 'Bikes'

k. Click Next to move to the next page.


l. In the Select the Report Type page, verify that Tabular is selected, and then
click Next.
NOTE: Fields can be added to m. In the Design the Table page, in the Available Fields list, select
the other sections of the report EnglishProductName, then click Details. Repeat for SalesAmount. Click Next.
either by using the Page and
Group buttons or by dragging The previous step adds the selected fields to the Details section of the report.
and dropping the fields into n. In the Choose the Table Style page, click Next.
the appropriate boxes. o. In the Completing the Wizard page, leave Report1 as the report name and click
Finish.
4. Modify the Report a. In the Layout view, in the Body section of the report, click inside the table (for
Layout. example, on the EnglishProductName label).
b. Move the cursor over the table column divider (in the grey bar above
EnglishProductName and SalesAmount) until it changes to a double arrow.
Click and drag the column width for the EnglishProductName column until it is
approximately two inches wide.
c. Click on the Report1 title, and replace it with Bike Price Report. Adjust the
field width so that it is wide enough to display the whole title. When you’re done,
the report should look like Figure 1.

Figure 1: Completed report design


NOTE: Reporting Services
may take a few moments to d. Select File | Save All.
preview the report. e. In the View pane, click the Preview tab.
A list of bikes with sales amounts will be displayed.
5. Close the Business a. Select File | Exit. Do not save any files when prompted.
Intelligence
Development Studio
environment.

Page 5 of 15
SQL Server 2005 Reporting Services

Page 6 of 15
SQL Server 2005 Reporting Services

Exercise 2
Creating a List Report
Scenario
In this exercise, you will create a simple report using Business Intelligence Development Studio and deploy that
report to the SQL Server Reporting Services report server.
To create the report, you will:
ƒ Create a Business Intelligence Development Studio solution and add a Report Project.
ƒ Create a Data Set.
ƒ Set up a query from a Data Set.
ƒ Design the layout of a report.
ƒ Deploy the finished report to the Report Server.
SQL Reporting Services report designer is hosted in the Business Intelligence Development Studio environment. It
provides you with an integrated development environment for designing, creating, testing, and debugging reports.

Tasks Detailed Steps


1. Launch the report a. Click Start | All Programs | Microsoft SQL Server 2005 | Business
design environment. Intelligence Development Studio.
Business Intelligence Development Studio provides the environment in which
Reporting Services reports are designed.
b. Choose File | New | Project.
c. In the New Project dialog box, in the Project Types pane, verify that the
Business Intelligence Projects folder is selected.
Business Intelligence Development Studio allows you to create a blank Visual Studio
2005 solution or to select one of the Business Intelligence templates such as Analysis
Services Project, Data Transformation Project, or Report Project.
d. In the Templates pane, select Report Project.
e. In the Name box, type AWReports.
f. In the Location box, enter C:\SQL Labs\User Projects and then click OK.
Tip: If the Solution Explorer g. In Solution Explorer, right-click AWReports, and select Add | New Item from
pane is not visible, click the context menu.
View | Solution
h. In the Add New Item – AWReports dialog box, in the Templates pane, select
Explorer.
Report (not Report Wizard).
i. In the Name text box, enter AWSales.rdl, and then click Add.
2. Create a new Dataset All reports need to have associated data. This source data information is created in a
Dataset.
a. At the top of the report designer, click the Data tab if it's not already selected.
The data view provides the tools to set up the Dataset and create the query
information you wish to report.
b. In the Dataset drop-down list, click <New Dataset…>.

Page 7 of 15
SQL Server 2005 Reporting Services

Tasks Detailed Steps

A dataset represents the specific fields queried from a data source. Multiple datasets
can be created using a single source.
c. In the Data Link Properties dialog box, on the Connection tab, in the Data
Source text box, type localhost.
Warning: Be sure there are no d. Under Enter information to log on to the server, select Use Windows NT
spaces in your DataSet name. integrated security.
e. In the Enter the initial catalog to use drop-down list, select
AdventureWorksDW, and then click OK.
f. Click the ellipsis (…) button to the right of the Dataset drop-down list.
g. In the Dataset dialog box, in the Name text box, replace the existing text with
SalesData.
h. Keep the dialog open and continue to Task 3.
3. Create a query for the a. From the Windows task bar, click Start |Run, type Notepad, and click OK.
Data Set. b. Choose File | Open and navigate to the C:\SQL Labs\Lab Projects\Reporting
Services Lab directory. Select Query.txt, and then click Open.
Using previously developed queries can save time when creating data sets. This also
allows users to develop queries using other tools, and then paste the SQL into this
interface.
c. In Notepad, press Ctrl+A to select all the text, press Ctrl+C to copy the text to
the clipboard, and then close Notepad.
d. Switch back to Business Intelligence Development Studio and paste the text in
the Query String text box of the Dataset dialog box by clicking the Query
String box, and pressing Ctrl+V.
e. Click OK to close the Dataset dialog box.
4. Create the first List a. In the View pane, click the Layout tab.
Object. b. In the Layout pane, move the mouse pointer to the bottom edge of the report
grid. When the mouse pointer changes into a vertical double-arrow icon, click
and drag downward to enlarge the report grid.
Tip: By default, the Toolbox is c. Click the Toolbox tab to maximize the Toolbox. In the Toolbox window,
located on the left side of the double-click the List item in the Report Items group. This will place an instance
screen. If the Toolbox window of the List control on the report design surface.
is not visible, select View | d. With the new List control still selected, click and drag the lower-right corner of
Toolbox. the control so that the control fills the width of the entire design surface and is
Important: If the Fields about one inch tall.
window is not already open, e. Drag EnglishProductCategoryName from the Fields window to the upper left
select View | Fields. corner of the List area in the report grid. Click and drag the right edge of the
field’s text box to make it approximately two inches wide.
f. With the EnglishProductCategoryName text box selected, press F4 to display
the Properties window with properties for this control.
g. In the Properties window, click the Font property. Expand the Font property to
display the FontWeight property. Change the FontWeight property from
Normal to Bold.

Page 8 of 15
SQL Server 2005 Reporting Services

Tasks Detailed Steps


h. Click inside the List area.
i. In the Properties window, select the Grouping property, and then click the
ellipsis button to the right of the property value.
j. In the Details Grouping dialog box, in the Expression list, click on the first row
then expand the drop-down list. Select
=Fields!EnglishProductCategoryName.Value, and click OK.
k. In the Fields window, click SalesAmount and drag it from the Fields window to
the upper right corner of the List area.
l. Expand the two text boxes vertically so that the expressions are visible, and
verify that they match Figure 2.

Figure 2: The completed layout.

m. Click on the SalesAmount text box to select it. In the Properties window, in the
Format property text box, type 0,0.00
n. Select File | Save All.
o. In the View pane, click the Preview icon. The results should look like Figure 3.
p. The report will generate and then show the three categories and a sales amount
total for each category.

Figure 3: The report in its current state.


5. Create the second List a. In the View pane, click Layout.
Object. b. Expand the List control to fill the entire design surface.
c. Click the Toolbox tab at the top left corner of the main window. After the
Toolbox appears, click List. Use the mouse to drag a rectangle that covers the
area inside the first List area and under the text boxes just added to the first List
area. Make sure that you leave some space between the text boxes and the new
List area. Use Figure 4 as your guide.

Page 9 of 15
SQL Server 2005 Reporting Services

Tasks Detailed Steps

Figure 4: Layout for the second List control

Nesting list objects facilitates grouping and sorting operations.


d. Select View | Fields. From the Fields window, drag
EnglishProductSubCategoryName to the upper left corner of the second (inner)
list area. Click and drag the right edge of the text box to make it approximately
two inches wide.
e. Click inside the second list area. In the Properties window, click the Grouping
property, and click the ellipsis button to the right of the property value (…).
f. In the Expression list, click on the first row, expand the drop-down list, and then
select =Fields!EnglishProductSubCategoryName.Value. Click OK.
g. In the first (outer) List area, right-click the SalesAmount text box. Click Copy,
right-click inside the second (inner) List area, and then click Paste. Drag the
SalesAmount textbox to the upper right corner of the inner List area.
h. Select File | Save All.
i. In the View pane, click Preview.
Both a category and a list of subcategories with corresponding sales amounts are
displayed.

NOTE: Reporting Services


may take a few moments to
preview the report.
6. Create the third List a. In the View pane, click Layout.
object. b. Click the Toolbox. In the Toolbox window, click List. Drag a rectangle that
covers the area inside the second List area under the text boxes just added to the
second List area.
c. Select View | Fields. From the Fields window, drag EnglishProductName to the
upper left corner of the third List area. Drag the right edge of the text box to
make it approximately two inches wide.
d. From the Fields window, drag the SalesAmount field to the upper-right corner of
the third List control.
e. Click on the SalesAmount text box to select it. In the Properties window, in the
Format property text box, type 0,0.00
f. Click inside the third List area. In the Properties window, click Grouping and

Page 10 of 15
SQL Server 2005 Reporting Services

Tasks Detailed Steps


then click the ellipsis (…) button.
g. In the Details Grouping dialog box, in the Expression list, click on the first row,
expand the drop-down list, and select =Fields!EnglishProductName.Value.
Click OK.
h. Reduce the size of the third List area to cover just around the text boxes, reduce
the size of the second List area to cover just around the third List area, and reduce
the size of the first List area to cover just around the second List area. The
finished report should look like Figure 5.

NOTE: Depending on your


individual report design, you
may need to adjust your
spacing in the Layout pane to
achieve optimal report layout.
A good rule of thumb is to
make sure that the list areas Figure 5: The finished report contains three list areas.
are just big enough to house
the text boxes without
overlapping. i. Select File | Save All.
j. In the View pane, click Preview.
All the detail for the category, subcategories, and products will be displayed.
7. Add Page Breaks to This report contains many lines of data and may be easier to read if it is broken into
the Report. pages.
a. In the View pane, click Layout.
b. Click inside the first (outermost) List area. In the Properties window, select the
Grouping property, and then click the ellipsis (…) button.
c. In the Details Grouping dialog box, select Page break at end, and then click
OK.
d. Select File | Save All.
e. In the View pane, click Preview.
Your report will begin each category listing with a fresh page. You can use the page
arrows in the Preview pane to navigate between pages of the report.
8. Create Parameters for Parameters can be used to further control the report’s data. For example, the product
a Report. category managers want to view the sales for their specific category. To meet each
manager’s reporting needs, define a product category at run time by specifying a
parameter value. This allows the same report to be customized for each product
category manager.
a. In the View pane, click on the Data tab.
b. In the SQL pane, move the cursor to the end of the SQL query, add a new line,
and then type:
WHERE EnglishProductCategoryName = @Category
c. In the View pane, click on the Preview icon.
TIP: If the report does not d. At the top of the Preview designer, in the Category text box, type Bikes, and
return any records, retry Step then click View Report.
4, ensuring that you type
Bikes in the Category text The category parameter will limit the report to just the Bikes category.
box. e. Select File | Save All.
9. Deploy a report to the Once the development of the report or project is completed, it can be deployed from
Report Server. the Business Intelligence Development Studio environment to the Report Server Web

Page 11 of 15
SQL Server 2005 Reporting Services

Tasks Detailed Steps


application where it will be available to end users.
a. Select Build | Configuration Manager.
b. In the Configuration Manager dialog box, set the Active Solution
Configuration to Production.
c. Click Close to dismiss the dialog box.
d. In the Solution Explorer, right-click the AWReports project and then select
Properties from the context menu.
e. In the AWReports Property Pages dialog box, under Deployment, in the
TargetServerURL text box, type http://localhost/reportserver and then click
OK.
f. Select the Build | Deploy Solution menu item. Watch the Output window for
status on the deployment.
Once the deployment has completed, you can view the report in a Web browser. In the
next exercise, you will browse deployed reports.
10. Close the Business a. Select File | Exit.
Intelligence
Development Studio
Environment.

Page 12 of 15
SQL Server 2005 Reporting Services

Exercise 3
Managing Security
Scenario
In this exercise, you will modify security settings for both the Report Server application and for a specific report by
using the Microsoft SQL Server Reporting Services Web application interface.
In this exercise, you will:
ƒ Create a system-level security role.
ƒ Apply a new system role to a group.
ƒ Create an item-level security role.
ƒ Apply a new item-level role to a report.
The security roles used by the Report Server Application use the groups and users set up in the Windows operating
system.

Tasks Detailed Steps


1. Create a new system a. From the Windows task bar, click Start | All Programs | Internet Explorer.
role. SQL Server Reporting Services is a Web application and is administered by using a
browser.
b. In the address bar, type http://localhost/Reports and press ENTER.
c. In the upper-right corner of the browser screen, click the link for Site Settings.
d. In the Security section near the bottom of the page, click Configure
system-level role definitions.
System Roles define the system level actions and permissions a group or user is
allowed. This includes permission to manage security, roles, shared schedules, and
server properties. These are inherited from their parent folder by default, but they can
NOTE: You may safely ignore be changed on an item-by-item basis.
any Internet Explorer error
e. Click the New Role button near the top of the page.
message that may appear at
this step. f. If a Internet Explorer error appears, dismiss it by clicking OK.
g. In the Name text box, type Report Analyst.
h. In the Description text box, type May view server properties and manage
shared schedules.
i. In the Select one or more tasks to assign to the role section, select Manage
shared schedules, View report server properties, and View shared schedules.
Figure 1 shows the completed page

Figure 1: Selected tasks for the new role.

Page 13 of 15
SQL Server 2005 Reporting Services

Tasks Detailed Steps


j. Click OK to save the changes.
2. Create a new Item- Access to a report can be fine-tuned for specific groups or users by creating item-
level security role. level roles that grant different permissions from the default permissions created when
a report is first deployed.
a. Click Site Settings.
b. Under Security, click the Configure item-level role definitions link.
Roles define the item-level actions and permissions a group or user is allowed. This
includes permissions to manage a report’s history, subscriptions, data sources,
folders, and security.
c. Click the New Role button.
d. In the Name text box, type ReadOnly.
e. In the Description text box type May only view server objects.
f. Select the check boxes for View data sources, View folders, View reports, and
View resources, and then click OK. Figure 3 shows the completed page.

Figure 3: Selected tasks for the ReadOnly role.

g. Click the Home link, click AWReports, and then click AWSales.
h. Click the Properties tab. On the left-hand side of the screen, click the Security
link, and then click the Edit Item Security button at the top of the window.
Permissions are inherited from their parent folder by default. Changing the default
permissions opens an information dialog box asking the user if they want to break the
inheritance of these permissions.
i. In the Microsoft Internet Explorer message box, click OK.
j. Click the Edit link to the left of the BuiltIn\Administrators label. Clear all
selected items, check the ReadOnly box, and then click Apply, as shown in
Figure 4.

Page 14 of 15
SQL Server 2005 Reporting Services

Tasks Detailed Steps

Figure 4: Assignments for the ReadOnly role

All users in the Administrators group set up in Windows will now only have the
ReadOnly permissions created above for the report.
The original report permissions can be restored by clicking Revert to Parent
Security.
k. Close Internet Explorer.

Page 15 of 15

You might also like