SQL Reporting Services
SQL Reporting Services
Anil Desai
◦ Independent Consultant (Austin, TX)
◦ Author of numerous SQL Server books
Certification
Training
◦ Instructor, “Implementing and Managing SQL Server
2005” (Keystone Learning)
◦ Info: http://AnilDesai.net
I. Intro to Reporting Services
II. Developing Reports
a) Defining Data Sources and Data Sets
b) Report Design: Basics
c) Report Design: Adding interactivity & parameters
III. Deploying and Managing Reports
a) Administering Reporting Services
b) Reporting Caching and Execution
c) Managing Snapshots & Report History
IV. Integrating Reports in Web and Windows
Applications
Part of the SQL Server 2005 Platform
Report Development
Report Builder
◦ Data models for creating ad-hoc reports
Programmability / Integration:
Application Programming Interface (API)
Web Services / Simple Object Access Protocol (SOAP)
Command-line utilities
Creating new data sources,
data sets, and report layouts
Report Wizard Goals:
◦ Provides a quick way to create basic reports
◦ Defines a data connection and query
◦ Includes formatting and grouping options
◦ Creates a new RDL file
Report Components:
◦ Page Header
◦ Report Title
◦ Page Number
◦ Report Data (Table)
Sorting, Grouping, and Drill-
Down
Query Sorting
◦ Useful for setting a “default” sort order
◦ Use an ORDER BY clause in the dataset query
Table-Level Sorting
◦ Default sort order specified in the “Sorting” tab
Interactive Sorting
◦ Data is sorted during report generation
◦ Sorted values are used for report output
◦ Can use a field or complex sort expression
◦ May be dependent on grouping scope
Grouping
◦ Helps to logically organize data
◦ Can create sub-totals in group footer
Drill-Down
◦ Group visibility can be dynamically-controlled by
other columns/values
◦ Report exports are based on the current view
Statements used to specify values
Can be used in table cells
Expression Editor
◦ Supports Intellisense
◦ Uses Visual Basic-style syntax
Examples:
◦ Globals!ReportName
◦ Globals!PageNumber
◦ Sum(Fields!SalesTotal.Value, “Sales")
◦ CountDistinct(Fields!ProductCategory)
◦ Fields!Employee.LastName + “,” + Fields!Employee.FirstName +
Using Parameters to filter
reporting data
Dataset / Query Level
◦ Uses parameter variables to restrict data returned
◦ Can also use stored procedure variables
Report Parameters
◦ Determined at report run-time
◦ Useful when users will be frequently changing
settings
Object Filtering
◦ Filter options for tables, charts, etc.
Can improve performance by minimizing data
returned
◦ Best used when filtering details are known before
report generation
Implemented using query parameters
◦ Variables: @StartDate, @EndDate
Query:
SELECT * FROM Sales
WHERE TransactionDate
BETWEEN @StartDate AND @EndDate
Evaluated at report run-time
Report Parameter Options:
◦ Data Types
◦ Prompt Options
Allow blank / null; Multi-value
◦ Available Values
Non-Queried or From Query
◦ Default values:
Non-Queried or From Query
Cascading Parameters
SQL Server Reporting Services Service
Report Manager Web Site
Business Intelligence Development Studio
Databases:
◦ ReportServer:
Report definitions, security settings, etc.
◦ ReportServerTempDB:
Cached data and user session information
Components may be installed on different
servers
From SQL
Server Books
Online
From www.microsoft.com/sql
Always run this report with the most recent
data
◦ Enable caching
Expired based on number of minutes
Expired based on a schedule
◦ Render report from a snapshot
Report Execution timeouts
◦ System Default
◦ Specified number of seconds
◦ None
Cache is created when a report is first run
Stores a copy of data in ReportServerTempDB
Can reduce impact on production
performance
Data may be out-of-date
Expires after a pre-defined amount of time
Data source security settings must be
configured
Events are executed by SQL Server Agent service
Schedule Types
◦ Report-Specific Schedules
◦ Shared Schedules
Defined at the system level
Tips:
◦ Keep track of time zones
◦ Use shared schedules whenever possible to allow
centralized management
◦ Distribute reporting processing workload over time
Point-in-time view of the contents of a report
◦ Data never changes
Report parameters must be defined before
running the snapshot
Usually created on a schedule
File Share
◦ Stores the output of a report to a file share
◦ Requires a shared folder accessible via UNC
Example: \\ReportServer\MarketingReports
Output file types
◦ XML
◦ Comma-separated values (CSV) – text file
◦ TIFF image files
◦ Web Archive
◦ Adobe Acrobat (PDF)
◦ Microsoft Excel (XLS)
◦ File Share Only
Web Page (HTML)
Web Archive
Snapshot-Based Subscriptions
◦ Notification is sent whenever a snapshot is created
Schedule-Based Subscriptions
◦ Uses a custom schedule (e.g., daily, monthly, etc.)
◦ Can have start and stop dates
Data-Driven Subscriptions
◦ Report recipients are defined by a query
◦ Table and query must be created manually
◦ Useful when managing large or very dynamic lists
of recipients
Hierarchical Security Model
◦ Folders can be used for logical organization
◦ Items inherit permissions
Security Layers
◦ System-Level Role Definitions
◦ Site-wide Security
◦ Item-Level Role Definitions
Role-Based system
◦ Roles are sets of permissions/capabilities
◦ Users can be assigned to multiple roles
Purpose / Benefits
◦ Can setup different sets of permissions
◦ Can setup different sets of parameters
Embedding Reporting Services
controls in Windows Forms
and Web applications
Windows Forms Applications
◦ Reporting Services Control
◦ Pointed to Reporting Services web site
Web Applications
◦ Can point directly to the Reporting Services Web
Site
◦ Creating customized security for accessing reports
by automating the API
Other Options:
◦ SharePoint Integration
◦ Using the Reporting Services API
www.microsoft.com/sql
Resources from Anil Desai
Microsoft Resources:
◦ SQL Server Web Site: www.microsoft.com/sql
◦ Microsoft Developer Network: msdn.microsoft.com
◦ Microsoft TechNet: technet.microsoft.com