An integrated part of the Microsoft business intelligence framework, Reporting Services combines the data management capabilities of SQL Server and Microsoft Windows Server with familiar
Trang 1By Michael Lisin, Jim Joseph
Publisher: Sams Pub Date: March 22, 2006 Print ISBN-10: 0-672-32799-6 Print ISBN-13: 978-0-672-32799-5 Pages: 480
Table of Contents | Index
SQL Server Reporting enables the creation, management, and delivery of both traditional, paper-oriented reports and interactive, Web-based reports An integrated part of the Microsoft business intelligence framework, Reporting Services combines the data
management capabilities of SQL Server and Microsoft Windows Server with familiar and powerful Microsoft Office System applications to deliver real-time information to support
Trang 2By Michael Lisin, Jim Joseph
Publisher: Sams Pub Date: March 22, 2006 Print ISBN-10: 0-672-32799-6 Print ISBN-13: 978-0-672-32799-5 Pages: 480
Trang 9Microsoft® SQL Server 2005 Reporting Services
Copyright © 2006 by Sams Publishing
All rights reserved No part of this book shall be reproduced,stored in a retrieval system, or transmitted by any means,
electronic, mechanical, photocopying, recording, or otherwise,without written permission from the publisher No patent
liability is assumed with respect to the use of the informationcontained herein Although every precaution has been taken inthe preparation of this book, the publisher and author assume
no responsibility for errors or omissions Nor is any liabilityassumed for damages resulting from the use of the informationcontained herein
regarded as affecting the validity of any trademark or servicemark
Trang 10Every effort has been made to make this book as complete and
as accurate as possible, but no warranty or fitness is implied.The information provided is on an "as is" basis The author(s)and the publisher shall have neither liability nor responsibility toany person or entity with respect to any loss or damages arisingfrom the information contained in this book
Bulk Sales
Sams Publishing offers excellent discounts on this book whenordered in quantity for bulk purchases or special sales For
Trang 12Christopher
Trang 13
Michael Lisin has been in the software industry for more than
14 years with 7 of those years working with Microsoft He iscurrently working as a senior strategy consultant with MicrosoftConsulting Services Michael has been working with SQL Serverfor six years and with SQL Server Reporting Services startingfrom the pre-Beta version in 2002 Michael has taught
Reporting Services classes and presented SQL Server-relatedtopics during various events Michael will complete his MBA
degree at Texas A&M this year
Jim Joseph is a manager at Continental Airlines Inc He
currently functions as a SQL Server DBA within the FinancialSystems Group with Continental Technology He earned his MBA
at the University of St Thomas in 2003, and undergraduate
degree in mathematics from there in 1999 In his spare time,
he enjoys spending time with his infant son, Christopher, andwife Deseere
Trang 14The authors would like to thank the publishing team workingwith us on this book Special thanks to: Neil, Mark, George,Karen, and Alex Thank you for your valuable feedback,
answers, and hard work on this book Without you all, this bookwould not be complete
Thank you to Brian Welcker, Richard Waymire, Robert Bruckner,Thierry D'Hers, David Crawford, Bogdan Crivat, Donovan Smith,and Eli Ilionsky for helping with questions that arose while
writing this book Thank you to Matt Whitten and Stephen
Rauch for getting Michael started with Reporting Services
Thank you to Kevin Swales for pointers about exception reports.
Trang 15As the reader of this book, you are our most important criticand commentator We value your opinion and want to know
what we're doing right, what we could do better, what areasyou'd like to see us publish in, and any other words of wisdomyou're willing to pass our way
As an associate publisher for Sams Publishing, I welcome yourcomments You can email or write me directly to let me knowwhat you did or didn't like about this bookas well as what wecan do to make our books better
Please note that I cannot help you with technical problems
related to the topic of this book We do have a User Servicesgroup, however, where I will forward specific technical questionsrelated to the book
When you write, please be sure to include this book's title andauthor as well as your name, email address, and phone number
I will carefully review your comments and share them with theauthor and editors who worked on the book
Trang 17SQL Server Reporting Services is a server-based, extensible andscalable platform that delivers and presents information based
on data that a business collects during its operation
Information, in turn, helps business managers to evaluate thecurrent state of the enterprise and make decisions on how toincrease revenues, reduce costs, and increase customer andemployee satisfaction
The Reporting Services scope extends from traditional paperreports to interactive content and various forms of delivery:email, file shares, and so on SSRS is capable of generating
reports in various formats, such as Hypertext Markup Language(HTML), Extensible Markup Language (XML), and Excel formats,thus allowing users to manipulate their data in whatever format
is required
Before diving into this book, let's take a moment to understandthe layout as well as some of the conventions used in the book.First, we cover how this book is organized and what you canexpect in each section Second, we cover the style and
formatting conventions used in this book It is particularly
noteworthy to note the style changes in reference to code lines,including SQL Server and NET code
How This Book Is Organized
This book begins with an introductory overview of SQL Server
2005 Reporting Services and covers a broad range of topics inthe areas of report authoring, Reporting Services deploymentand administration, and custom code development for ReportingServices
The chapters in Part I, "Introduction to Reporting Services,"
Trang 18highlight key features of the Reporting Services, deploymentscenarios, typical users of Reporting Services, and ReportingServices architecture This part allows for leisurely reading anddoes not require you to have access to a computer
The chapters in Part II, "Report Authoring from Basic to
Advanced," take you through report development tools andprocesses This part describes report building blocks and walksthrough building a report from simple to complex
The chapters in Part III, "Reporting Services Administration andOperations," discuss advanced topics of Reporting Services
administration, such as setting proper security, managing
Reporting Services as individual servers and in a web farm, andgathering report execution information
The chapters in Part IV, "Developing for Reporting Services,"are for those of you who might want to extend Reporting
Services and incorporate reports in their applications This partcovers key programmable aspects of Reporting Services
Server 2005, SQL Server Reporting Services, Visual Studio
Trang 198\Common7\IDE\PrivateAssemblies) and SSRS (default is C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting
Services\ReportServer\bin)."
Error numbers, codes, and messages: "
[rsInvalidReportParameterDependency] The report parameter
'SalesOrderId' has a DefaultValue or a ValidValue that depends on the report parameter "MaxOrderId" Forward dependencies are not valid."
Names of permissions, constants, properties, collections,and variables: Execute, Fields, ReportParameter, Parent
To indicate adjustable information, we use
"{}", mostly where the variable information can be
confused with XML, for example <Value>{EXPRESSION}</Value> Inthis example, an {EXPRESSION} is any valid expression,such as =Fields!ProductImage.Value
Trang 22Chapter 1 Introduction to SQL Server Reporting Services (SSRS)
Trang 23Editions of SSRS
Licensing SSRS
Trang 24SSRS is Microsoft's answer to business reporting It provides aunified, server-based, extensible, and scalable platform fromwhich to deliver and present information Its scope extendsfrom traditional paper reports, to web-based delivery and
interactive content SSRS can also be configured to deliver
reports to peoples' inboxes, file shares, and so on SSRS iscapable of generating reports in various formats, such as theweb-oriented Hypertext Markup Language (HTML) and desktopapplication (Microsoft Excel and CSV) formats, thus allowingusers to manipulate their data in whatever format is required
SSRS is just one of the components in the Microsoft BusinessIntelligence (BI) platform Combined, those components
provide an excellent platform for enterprise data analysis TheMicrosoft BI platform includes the following:
SQL Server The traditional database engine, which also
stores SSRS' catalog data
SQL Server Analysis Services (SSAS) A component for
online analytical processing (OLAP) and data mining OLAPperforms data aggregation and allows users to traversefrom aggregations to details looking though the dimensions(such as geography or time) of data Data mining helpsusers to discover patterns in data
SQL Server Integration Services (SSIS) A component
for extracting, transforming, and loading (ETL) data
SQL Server Notification Services (SSNS) A component
for deploying and sending notifications of changing data
Trang 25SSRS is unique in the Microsoft Business Intelligence suite, as itcovers a variety of information users Microsoft divides usersinto three groups: information consumers, information
explorers, and analysts
Table 1.1 briefly summarizes the percentages of users in eachgroup, the level of technical experience, and the expectationsfrom an enterprise reporting tool All of these factors will varyfrom company to company, but generally the breakdown holdstrue
Table 1.1 Breakdown of Information Workers
Type of
User Percentage
Technical Expertise Expectation
Analysts 5%-10% High Analysts can develop
reports, work with ad hoc reports, and perform sophisticated calculations (such as linear regressions and trend analysis).
Analysts often publish reports to explorers and consumers.
Information
explorers
15%-30% Medium Information explorers want
to interact with reports to some degree, such as applying filters or performing drill down through.
Information
consumers
55%-85% Low Information consumers use
static, predefined, and preformatted reports.
Trang 26provides three main tools from the user perspective:
Report Viewer The primary mechanism for viewing reports
over the Web Report Manager is the name of the websitethat SSRS sets up It provides a very clean and neatly
organized user interface for end users Developers can alsoembed a Report Viewer control into both ASP.NET and
Windows Forms applications
Report Builder The tool that provides users with a front
end for ad hoc reporting against a SQL Server or AnalysisServices database Unlike most ad hoc reporting tools,
Figure 1.1 summarizes the type of reporting users, and
mentions some of the tools SSRS brings to the table for them
Figure 1.1 Reporting Services users and tools.
Trang 28SSRS has a number of features to address complex businessreporting needs Over the course of this book, these featuresare explored more closely For now, here is a brief overview:
SSRS can be used across the enterprise by various userssimultaneously
SSRS leverages NET data providers and can query a variety
of data sources Examples of the NET providers are SQLServer, Oracle, Analysis Services, Microsoft Access, and
many more If needed, SSRS can also be extended throughthe custom data-processing extensions
SSRS includes delivery mechanisms to distribute reports toindividual users on demand or on a scheduled basis
As you can see, SSRS provides a comprehensive set of featuresout of the box Another nice feature of SSRS is its extensibility.Because there is no way that the developers of SSRS could
Trang 29in any number of ways from embedded reports to customizedreporting solutions
Trang 30
Each user is likely to have favorite reports to make timely andeffective business decisions and although it is not possible tocover a whole gamut of reports in this book, some commonideas can help you think through practical applications of SSRS
Score card reports are frequently used in today's businessesand provide information for each manager on how well his
group is doing as compared to the goals set for the group
Usually, a score card implements a "traffic light" type of
highlight or a "gage" indicator Values on the score card are
highlighted in green when the group is meeting its goals, inyellow when the group is doing so-so, and in red when the
group's performance requires immediate attention Score cardreports can now take advantage of the new feature of AnalysisServices 2005: Key Performance Indicators (KPI)
When users are looking to combine a comprehensive set of
business health and "speed" gages (score card) and relatedinformation in a small space, a dashboard is used to accomplishthis goal A dashboard provides a short, typically one-page,summary view of a business (much like a car's dashboard
summarizes a car's status) and allows drill down through theitems on the top page to retrieve detailed information
SharePoint is an excellent platform to host dashboards and
greatly simplifies arranging reports in the meaningful fashion on
a page
Today, when everybody is so short on time, it might be easy tomiss an information point that could prove fatal for a business.Exception reporting is what comes to the rescue of a time-
constrained user Unlike regularly scheduled reports or
summaries provided by score cards, exception reports are
created and delivered to a user when an unusual event occurs
An exception report removes the "noise" created in periodic
Trang 31example of such an anomaly could be a sudden drop in dailysales for a particular region
Other typical reports include various views of sales (geographic,demographic, product, promotion breakdowns), inventory,
customer satisfaction, production, services, and financial
information
Trang 32To understand all of the ways SSRS can be used and deployed,you can simply walk through the report development life cycle,and see what features are useful in each stage
A typical reporting application goes through three stages (see
Figure 1.2): authoring, managing, and delivery SSRS providesall the necessary tools to work with a reporting application in allthree stages
Figure 1.2 Reporting life cycle.
[View full size image]
Authoring Stage of the Reporting Life Cycle
Trang 33Designer is a tool that was previously available for SSRS2K ForSSRS2K, developers had to install Visual Studio 2003
Integrated Development Environment (IDE) for the Report
Designer to function Although integration with Visual Studio isstill available in SSRS, today developers have a choice to useReport Designer within Visual Studio IDE or to use Report
Designer within Business Intelligence Development Studio
(BIDS) The Business Intelligence Development Studio shell hasgone through changes from Beta 2 of SSRS Starting from theCommunity Technology Preview release of SSRS, Visual StudioExpress Edition, a free version of Visual Studio 2005 is includedwith SQL Server 2005 as a shell for the Report Designer TheReport Designer interface is shown in Figure 1.3
Figure 1.3 Report Designer.
[View full size image]
Trang 34targets developers and provides extensive design capabilitiesand can handle a variety of data sources Report Designer canwork with all reports generated for SSRS, including reports
generated by Report Builder Report Designer incorporates thefollowing productivity features:
Import Access reports, which allows designers to importMicrosoft Access reports and creates a report definition inturn In complex cases, it might not be able to successfully
or completely import an Access report The general rule ofthumb is that SSRS will be able to convert approximately80% of the existing Access reports
NEW in 2005IntelliSense for expression editing, which
provides assistance with the syntax of a function used inexpressions, names of class members, and indicates syntaxerrors in expressions by underlining them with squiggly redlines You will see more details of this feature in Chapter 8,
"Expressions."
NEW in 2005Multidimensional Expressions (MDX) and Data
Mining Expressions (DMX) query designer, which provides adrag-and-drop interface for writing MDX and DMX queries.This feature is covered in more details in Chapter 15,
"Working with Multidimensional Data Sources."
Relational query designer, which provides a drag-and-dropinterface for writing SQL queries
Report Wizard, which provides step-by-step instructions tocreate a report
Trang 35Publishing and deployment functionality, which allows a
report designer to publish a report to a target server Forexample, the developer might choose to publish to a
Before an end user can develop a report, a developer must
create a model, using the Model Builder tool Figure 1.4 depictsthe Model Builder's interface A model is similar to a report, inthat a model is a file written in Extensible Markup Language(XML) with an extension of SMDL A model defines layout, datasources, data entities, and relationships in terms that are
understood by end users and not in terms of SQL or MDX
Figure 1.4 Model Builder.
[View full size image]
Trang 36an end user can create ad hoc reports, based on the publishedmodel Figure 1.5 shows the Report Builder interface
Figure 1.5 Report Builder.
[View full size image]
Trang 37Report Builder targets end users and provides access to datasources predefined in a mode.
Trang 38party vendors to develop custom authoring tools
Services database RDL is an open language that allows third-Managing Stage of the Reporting Life Cycle
During this stage, the report author publishes the report to acentral location where it can be managed by a report
administrator in terms of security and delivery This central
location is a SSRS database After the report is published, theadministrator can use Report Manager, custom written scripts,third-party tools, or SQL Server Management Studio to managepublished reports The report administrator can
Assign the report's security or the right a user might have
to a report
Establish execution control, such as selecting a time of anexecution or caching options
Access and organize subscriptions from a single location
Control report execution properties, which controls how andwhen reports are processed For example, the administratorcan set processing options to prevent a large report fromrunning on demand
Set timeout values to prevent a single report from
overloading system resources
Trang 39preferences Users who prefer to view a report in Excel, forexample, can specify that format in a subscription
Automate report distribution through data-driven
subscriptions A data-driven subscription generates a
recipient list and delivery instructions at runtime from anexternal data source A data-driven subscription uses a
query and column-mapping information to customize reportoutput for a large number of users
Set delivery methods for a report, such as file share, printer(this would require a custom extension in the current
release, which is discussed in Chapter 26, "Writing CustomReporting Services Extensions"), or email
Figure 1.6 depicts the Report Manager's interface
Figure 1.6 Report Manager.
[View full size image]
Trang 40Figure 1.7 Reporting Services Configuration
Manager.
[View full size image]