SQL Reporting Services

50
Ms.Neha Mittal

Transcript of SQL Reporting Services

Page 1: SQL Reporting Services

Ms.Neha Mittal

Page 2: 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

Page 3: SQL Reporting Services

I. Intro to Reporting ServicesII. Developing Reports

a) Defining Data Sources and Data Setsb) Report Design: Basicsc) Report Design: Adding interactivity & parameters

III. Deploying and Managing Reportsa) Administering Reporting Servicesb) Reporting Caching and Executionc) Managing Snapshots & Report History

IV. Integrating Reports in Web and Windows Applications

Page 4: SQL Reporting Services
Page 5: SQL Reporting Services

Part of the SQL Server 2005 Platform Report Development

◦ Visual report design◦ Business Intelligence Development Studio◦ Report Features

Grouping Sorting Filtering Drill-Down and Drill-Through Charting

XML-based Report Files (.rdl)

Page 6: SQL Reporting Services

Report Types◦ Table◦ Matrix◦ Charts

Report output:◦ Report Viewer (web site)◦ Page-based (HTML, TIFF, PDF)◦ Application integration (Web / Windows Forms)

Export Formats: ◦ Adobe PDF, XML, Microsoft Excel, CSV, TSV◦ CSV

Page 7: SQL Reporting Services

Management◦ Web-based interface◦ Command-line management tools

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

Page 8: SQL Reporting Services

Creating new data sources, data sets, and report layouts

Page 9: SQL Reporting Services
Page 10: SQL Reporting Services

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

Launching the Report Wizard:◦ New Project Report Server Project Wizard◦ Add Item Report Wizard

Page 11: SQL Reporting Services
Page 12: SQL Reporting Services

Specifies connection information for reporting data

Supported Data Sources:◦ Any OLEDB / ODBC-compliant data source◦ Relational

SQL Server Oracle MS Access

◦ OLAP / Multi-Dimensional SQL Server Analysis Services

◦ XML, Excel, CSV, TSV, etc.

Page 13: SQL Reporting Services

Data Source Details◦ Data source type◦ Connection options◦ Security credentials

Private Data Sources (Report-specific)◦ Stored within the report (.RDL) file

Shared Data Sources◦ Defined at the Project / Server level◦ Can be used across multiple reports◦ Useful for development/production environments

Page 14: SQL Reporting Services

Identifies data to be used for report generation◦ Can have many different datasets per report◦ Requires a data source (shared or embedded)◦ Fields are available for use in reports

Dataset Options◦ Query (Text or Stored Procedure)◦ Fields◦ Data Options◦ Parameters◦ Filters

Page 15: SQL Reporting Services

Query Designer Features◦ Visual creation of joins◦ Can access tables, views, and functions◦ Column names and aliases◦ Query sorting and filtering options◦ Query results

Screen sections◦ Diagram Pane◦ Grid Pane◦ SQL Pane◦ Result Pane

Page 16: SQL Reporting Services
Page 17: SQL Reporting Services

Report◦ Page Header◦ Page Footer◦ Body (Report Area)

Table Regions◦ Header◦ Detail◦ Footer

Groups◦ Can specify page breaks

Page 18: SQL Reporting Services
Page 19: SQL Reporting Services

Report Requirements:◦ Show a list of all products by Category /

Subcategory◦ Drill-down, sorting, and grouping are not required

Report Components:◦ Page Header◦ Report Title◦ Page Number◦ Report Data (Table)

Page 20: SQL Reporting Services

Sorting, Grouping, and Drill-Down

Page 21: SQL Reporting Services

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

Page 22: SQL Reporting Services

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

Page 23: SQL Reporting Services
Page 24: SQL Reporting Services

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 +

Page 25: SQL Reporting Services
Page 26: SQL Reporting Services
Page 27: SQL Reporting Services

Using Parameters to filter reporting data

Page 28: SQL Reporting Services

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.

Page 29: SQL Reporting Services

Can improve performance by minimizing data returned◦ Best used when filtering details are known before

report generation Implemented using query parameters

◦ Variables: @StartDate, @EndDateQuery:SELECT * FROM Sales WHERE TransactionDate BETWEEN @StartDate AND @EndDate

Page 30: SQL Reporting Services

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

Page 31: SQL Reporting Services
Page 32: SQL Reporting Services

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

Page 33: SQL Reporting Services

From SQL Server Books Online

Page 34: SQL Reporting Services

From www.microsoft.com/sql

Page 35: SQL Reporting Services
Page 36: SQL Reporting Services

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

Page 37: SQL Reporting Services

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

Page 38: SQL Reporting Services

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

Page 39: SQL Reporting Services

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◦ End-of-month or end-of-year reports

Scheduling◦ Report-specific schedule◦ Shared schedule

Page 40: SQL Reporting Services

Used to maintain snapshot copies over time◦ Often used for auditing or historical reference

Scheduling:◦ Store all snapshots◦ Use a report-specific schedule◦ Use a shared schedule

Options:◦ Keep an unlimited number of snapshots◦ Limit the number of copies of report history

Page 41: SQL Reporting Services

E-Mail◦ Uses SMTP server defined in Reporting Services

Configuration tool◦ Can send report as attachment◦ Can send a link to the report

File Share◦ Stores the output of a report to a file share◦ Requires a shared folder accessible via UNC

Example: \\ReportServer\MarketingReports

Page 42: SQL Reporting Services

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

Page 43: SQL Reporting Services

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

Page 44: SQL Reporting Services

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

Page 45: SQL Reporting Services

Role-Based system◦ Roles are sets of permissions/capabilities◦ Users can be assigned to multiple roles

Based on Windows Authentication◦ Provides for centralized security management◦ May use Active Directory users and groups◦ Other authentication can be developed

Page 46: SQL Reporting Services

Creates a “virtual report” ◦ Uses the same report definition (.rdl) as the

parent report, but with independent settings

Purpose / Benefits◦ Can setup different sets of permissions◦ Can setup different sets of parameters

Page 47: SQL Reporting Services

Embedding Reporting Services controls in Windows Forms and Web applications

Page 48: SQL Reporting Services

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

Page 49: SQL Reporting Services

www.microsoft.com/sql Resources from Anil Desai

◦ Web Site (http://AnilDesai.net)◦ E-Mail: [email protected]

Keystone Learning Course: “Microsoft SQL Server 2005: Implementation and Maintenance (Exam 70-431)”

The Rational Guide to Managing Microsoft Virtual Server 2005

The Rational Guide to Scripting Microsoft Virtual Server 2005

Page 50: SQL Reporting Services

ReportingServicesGuru.com◦ Course: “Administering Reporting Services”◦ Online forums and news◦ Consulting information

SQL Server 2005 Books Online◦ Database Engine◦ Reporting Services

Microsoft Resources:◦ SQL Server Web Site: www.microsoft.com/sql◦ Microsoft Developer Network: msdn.microsoft.com◦ Microsoft TechNet: technet.microsoft.com