1. Trang chủ
  2. » Công Nghệ Thông Tin

PROFESSIONAL MICROSOFT® SQL SERVER® 2012 REPORTING SERVICES doc

916 9K 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Professional Microsoft® SQL Server® 2012 Reporting Services
Trường học University of Information Technology, Vietnam National University Ho Chi Minh City
Chuyên ngành Information Technology / Computer Science
Thể loại Textbook
Năm xuất bản 2012
Thành phố Ho Chi Minh City
Định dạng
Số trang 916
Dung lượng 46,58 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

581 PART VII REPORTING SERVICES CUSTOM PROGRAMMING CHAPTER 20 Integrating Reports into Custom Applications.. His books include SQL Server Reporting Services Recipes for Designing Expe

Trang 3

INTRODUCTION xxxvii

 PART I GETTING STARTED CHAPTER 1 Introducing Reporting Services 3

CHAPTER 2 Reporting Services Installation and Architecture 23

CHAPTER 3 Confi guring SharePoint Integration 69

 PART II REPORT DESIGN CHAPTER 4 Basic Report Design 95

CHAPTER 5 Report Layout and Formatting 123

CHAPTER 6 Designing Data Access 143

CHAPTER 7 Advanced Report Design 189

CHAPTER 8 Chart Reports 229

 PART III BUSINESS INTELLIGENCE REPORTING CHAPTER 9 BI Semantic Models 251

CHAPTER 10 Reporting with Analysis Services 263

CHAPTER 11 OLAP Reporting Advanced Techniques 295

 PART IV ENABLING USER REPORTING CHAPTER 12 Tabular Models 349

CHAPTER 13 Visual Analytics with Power View 373

CHAPTER 14 Report Builder Solution Strategies 445

Trang 4

CHAPTER 18 Integrating Reports with SharePoint 559

CHAPTER 19 Native Mode Server Administration 581

 PART VII REPORTING SERVICES CUSTOM PROGRAMMING CHAPTER 20 Integrating Reports into Custom Applications 619

CHAPTER 21 Using Embedded and Referenced Code 681

CHAPTER 22 Extending Reporting Services 697

 PART VIII APPENDIXES APPENDIX A T-SQL Commands, Clauses, and Predicates 758

APPENDIX B T-SQL System Variables and Functions 779

APPENDIX C MDX Reference 803

INDEX 829

Trang 7

Paul Turley, Robert M Bruckner, Thiago Silva, Ken Withee, and Grant Paisley

Trang 8

No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means,

electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108

of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization

through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers,

MA 01923, (978) 750-8400, fax (978) 646-8600 Requests to the Publisher for permission should be addressed to the

Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201)

748-6008, or online at http://www.wiley.com/go/permissions.

Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with

respect to the accuracy or completeness of the contents of this work and specifi cally disclaim all warranties, including

without limitation warranties of fi tness for a particular purpose No warranty may be created or extended by sales or

promotional materials The advice and strategies contained herein may not be suitable for every situation This work

is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional

services If professional assistance is required, the services of a competent professional person should be sought Neither

the publisher nor the author shall be liable for damages arising herefrom The fact that an organization or Web site is

referred to in this work as a citation and/or a potential source of further information does not mean that the author or the

publisher endorses the information the organization or Web site may provide or recommendations it may make Further,

readers should be aware that Internet Web sites listed in this work may have changed or disappeared between when this

work was written and when it is read.

For general information on our other products and services please contact our Customer Care Department within the

United States at (877) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002.

Wiley publishes in a variety of print and electronic formats and by print-on-demand Some material included with

standard print versions of this book may not be included in e-books or in print-on-demand If this book refers to

media such as a CD or DVD that is not included in the version you purchased, you may download this material at

http://booksupport.wiley.com For more information about Wiley products, visit www.wiley.com.

Library of Congress Control Number: 2012933621

Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, Wrox Programmer to Programmer, and related trade dress

are trademarks or registered trademarks of John Wiley & Sons, Inc and/or its affi liates, in the United States and other

countries, and may not be used without written permission Microsoft and SQL Server are registered trademarks of

Microsoft Corporation All other trademarks are the property of their respective owners John Wiley & Sons, Inc., is not

associated with any product or vendor mentioned in this book.

Trang 9

— Robert M Bruckner

I dedicate this book to my beautiful wife, Michelle, who still loves me and encourages me, after all these years; to my children, Gabriella, Joshua, and Olivia, who brighten my life with their smiles and unconditional hugs; and to my mother Lucia who

keeps believing that I am a rockstar.

— Thiago Silva

I dedicate this book to my wife and best friend,

Rosemarie Withee.

— Ken Withee

I dedicate this book to my wife Sue, who still loves

me after all these years; to my teenage kids, Megan, Lisa, and Zoe, who have turned out even better than I could have hoped; and to mum and dad who gave me the opportunity and encouragement to always do and

learn new things.

— Grant Paisley

Trang 11

tions since 1991 for companies like Microsoft, Disney, Nike, and Hewlett-Packard He has been a Microsoft Certifi ed Trainer since 1996 and holds several industry certifi cations, including MCTS and MCITP for BI, MCSD, MCDBA, MSF Practitioner, and IT Project+.

Paul has authored and coauthored several books and courses on databases, business intelligence,

and application development technologies His books include SQL Server Reporting Services

Recipes for Designing Expert Reports, Professional SQL Server 2008 Reporting Services, Professional SQL Server 2005 Reporting Services, Professional SQL Server Reporting Services (SQL Server 2000), Beginning T-SQL with SQL Server 2005 and 2008, Beginning Transact-SQL with SQL Server 2000 and 2005, Beginning SQL Server 2005 Administration, Beginning Access

2002 VBA, Data Warehousing with SQL Server 2000 Analysis Services, and Professional Access

2000 Programming — all from Wrox He is also the lead author for SQL Server 2005 Integration Services Step by Step from Microsoft Press.

ROBERT M BRUCKNER, is a principal software architect and developer with the Microsoft SQL Server division Robert is responsible for the technical architecture of SQL Server Reporting Services including Power View One of Robert’s core areas has been the design and development of the scal-able report processing engine, utilized by Reporting Services and Power View Power View is an enhancement of Reporting Services 2012, enabling end-users to easily and interactively visualize data, quickly gain analytical insights, and simply have fun exploring data!

Prior to joining Microsoft in 2003, Robert researched, designed, and implemented database and business intelligence systems as a system architect at T-Mobile Austria, and as a researcher at Vienna University of Technology, Austria Robert holds Master and PhD degrees with highest distinctions in Computer Science from Vienna University of Technology, and holds several patents.Anyone good with a search engine can fi nd thousands of Robert’s past postings on public news-groups and MSDN forums sharing his insights, tips, tricks, and expert advice related to Reporting Services and other SQL Server technologies Robert has co-authored books on SQL Server

Reporting Services as well as Analysis Services Robert regularly presents at industry conferences and also maintains a popular blog at: http://blogs.msdn.com/robertbruckner. In his spare time, Robert enjoys mountain biking, skiing, and reading

THIAGO SILVA is an MCPD and an architect and consultant for Credera Thiago has been ing custom NET and Reporting Services since the early days of NET and SQL Server 2000 He is a part of the Microsoft practice within Credera, a Dallas-based consulting fi rm, delivering Microsoft solutions to clients that include several Fortune 500 companies He has worked as a consultant for the last eight years and as a software engineer and web developer prior to that Thiago is co-author

Trang 12

develop-MCPD, and MCTS titles for web development using ASP.NET 2, 3.5, and 4.

KEN WITHEE is President of Portal Integrators LLC (www.portalint.com), a software

develop-ment company focused on developing world class business applications for the SharePoint platform

He lives with his wife Rosemarie in Seattle, Washington, and is the author or coauthor of several

books including Microsoft Offi ce 365 For Dummies (Wiley, 2011), SharePoint 2010 Development

For Dummies (Wiley, 2011), Professional Microsoft Project Server 2010 (Wrox, 2012), Microsoft

Business Intelligence For Dummies (Wiley, 2010), Professional Microsoft SQL Server 2012

Reporting Services (Wrox, 2012), and Professional Microsoft SQL Server 2008 Reporting Services

(Wrox, 2008) Ken has also written a number of other published works in a variety of journals and

magazines

Ken earned a Master of Science degree in Computer Science studying under Dr Edward Lank at

San Francisco State University Their work has been published in the LNCS journals and was the

focus of a presentation at the IASTED conference in Phoenix Their work has also been presented at

various other Human Computer Interaction conferences throughout the world

Ken has more than 12 years of professional computer and management experience working with

a vast range of technologies He is a Microsoft Certifi ed Technology Specialist and is certifi ed in

SharePoint, SQL Server, and NET

GRANT PAISLEY is an SQL Server MVP and founder of Angry Koala, a Microsoft Business

Intelligence consultancy based in Sydney, Australia Grant is president of the SQL Server Usergroup

Sydney and is an internationally recognized speaker who has spoken at TechEd USA, Australia, and

even China His passion about BI, in particular with visualization of data, resulted in Grant

creat-ing http://reportsurfer.com, a community reporting site Grant was also a contributing author

for SQL Server 2008 Analysis Services with MD and Microsoft SQL Server Reporting Services

Recipes If you don’t see him on stage presenting, you might see him on the water kite surfi ng in

Hawai’i or mountain biking in Whistler

Trang 13

TECHNICAL EDITORS

Joe SalvatoreChris AlbrektsonNigel Sammy

Mary Beth Wakefi eld

FREELANCER EDITORIAL MANAGER

Trang 15

to books, papers, projects, and events To my wife Sherri who says “Honey, I love you, but if you bring home one more piece of conference swag, you’ll sleep in the garage.”

…the Reporting Services and SQL Server BI product teams at Microsoft; Thierry, Sean, Carolyn, Lukasz, Ariel, Robert, and many others who have been open and available for the past nine years of books, projects, and support Thank you for letting me play a small role in your quest to avail these fantastic technologies to people who use them to deliver information and make important things happen all over the world Thanks to Mark, Chuck, Denny, Carl, John, and the SQL CAT team

…the Microsoft MVP organization for building an unbelievable network of dedicated professionals

To the SQL Server PASS organization who have nurtured a respected and trusted community To Arnie and the Oregon SQL team for being my “homies.” Thanks to all the PASS chapter directors and SQL Saturday organizers everywhere

…everyone at SolidQ for building a stellar organization, unlike any other I’m proud to be counted among so many trusted friends and professionals

A heartfelt thanks to the editorial and management team at Wiley; especially Bob and Kelly How you maintain your sanity trying to manage those who write books in our “spare” time is beyond

my comprehension Thank you for your enduring patience and perseverance Thank you to my co-authors and reviewers; Robert, Ken, Grant, Thiago, Joe, Chris, Nigel, and Glyn who have endured endless nights and weekends, reviews, and rewrites Just one more revision and we should

be done, guys! Thank you all for making this book happen

I have a profound respect for those who write “those other” books, and who I consider to be peers and co-contributors to a vibrant industry Thank you Stacia, Teo, and Brian for keeping the bar high and for your contributions to the industry

— Paul Turley

Robert would like to thank in particular Paul Turley and Bob Elliott for great collaboration out this project, drawing from the experience of several seasoned Reporting Services experts, and collecting proven best practices from large-scale customer deployments of Reporting Services

through-Furthermore, Robert would like to express a big “thank you” to all co-authors contributing to this book, to Kelly Talbot for great editorial work, and to technical reviewers for ensuring accuracy

— Robert M Bruckner

Trang 16

during the writing of this book I appreciate their love and encouragement and could not have done

this without them

— Thiago Silva

I would like to acknowledge my grandma Tiny Withee who turns 99 this year and is still going

strong I would also like to acknowledge my wife Rosemarie Withee, mother Maggie Blair, father

Ken Withee, sister Kate Henneinke, and parents-in-law Alfonso and Lourdes Supetran and family

An extraordinary amount of thanks goes to my co-authors; Paul Turley, Robert Bruckner, Thiago

Silva, and Grant Paisley Special thanks to Bob Elliott, Kelly Talbot, Gayle Johnson, Joe Salvatore,

Chris Albrektson, Nigel Sammy, and the rest of the Wrox team for making this book a reality

— Ken Withee

Thank you to the Angry Koala Team, Glyn Llewellyn who picks up the reins in my absence and

helped in the writing of my chapters; Colin McGowan, David Lean, Geoff Orr, Mark Fitzpatrick,

Lesley Llewellyn, Peter Orgill, and Praveen Chand, who through their professionalism and

enthusi-asm for BI, are the backbone to my success Thanks to my good friend Paul Turley for opportunity

and support during authoring; Kelly and the team at Wrox for their invaluable role in getting the

book into production And fi nally my family Sue, Megan, Lisa, and Zoe that I love but rarely say so

Oh and I nearly forgot: “Megan is awesome” — actually you all are!

— Grant Paisley

Trang 17

FOREWORD xxxv

INTRODUCTION xxxvii

PART I: GETTING STARTED

Summary 20CHAPTER 2: REPORTING SERVICES INSTALLATION

Installing the Reporting Services Samples and

Trang 18

Authoring 47Management 47Delivery 47

Subscriptions 52

Snapshots 60

Trang 19

ReportServer 65ReportServerTempDB 66

Summary 66CHAPTER 3: CONFIGURING SHAREPOINT INTEGRATION 69

Installing and Confi guring PowerPivot for SharePoint 77Installing and Confi guring Reporting Services for SharePoint 81

Architecture 90 Summary 91 PART II: REPORT DESIGN

Trang 20

Creating Drill-Down Reports and Dynamic Visibility 136

Summary 142

Trang 21

Creating a Data Source from the Project Add Item Template 149

Summary 187

Using a List to Combine Report Items and

Trang 22

Control the Number of Items Displayed on an Axis 246

Control the Width and Gap Between Columns or Bars 246For a Chart with Multiple Chart Areas, Control the Exact Position

Summary 247 PART III: BUSINESS INTELLIGENCE REPORTING

Trang 23

Summary 293CHAPTER 11: OLAP REPORTING ADVANCED TECHNIQUES 295

Parameters 296Dataset 297

Tablix 308

Summary 309

Trang 24

Relationships 364

Trang 25

Creating a SharePoint Image Library for FAA Airline Images 384Publishing the FAA Workbook Directly to the PowerPivot Gallery 386

Matrix 409Slicers 410Filters 410

Trang 26

Deploying a PowerPivot Workbook to Analysis Services Tabular 440

Summary 442

Resources 443

CHAPTER 14: REPORT BUILDER SOLUTION STRATEGIES 445

Trang 27

Review 457Consolidate 458Design 458Test 458Maintain 459

Summary 459 PART V: SOLUTION PATTERNS

Trang 28

Summary 482CHAPTER 16: REPORT SOLUTIONS, PATTERNS, AND RECIPES 483

Working with the Strengths and Limitations of the Architecture 484

Summary 521 PART VI: ADMINISTERING REPORTING SERVICES

Trang 29

SharePoint Foundation and SharePoint Server Standard Edition 564

Summary 579CHAPTER 19: NATIVE MODE SERVER ADMINISTRATION 581

Security 582

Trang 30

CHAPTER 20: INTEGRATING REPORTS INTO CUSTOM APPLICATIONS 619

Parameters 628

Trang 31

Confi guring ASP.NET 2.0 in IIS 6 and Older Versions 662

Embedding a Server-Side Report in a Windows Application 672

Summary 678CHAPTER 21: USING EMBEDDED AND REFERENCED CODE 681

Summary 695CHAPTER 22: EXTENDING REPORTING SERVICES 697

Trang 33

PART VIII: APPENDIXES

APPENDIX A: T-SQL COMMAND SYNTAX REFERENCE 757

WITH 758SELECT 758

FROM 760WHERE 760

SET 765LIKE 765

Trang 34

APPENDIX B: T-SQL SYSTEM VARIABLES AND FUNCTIONS 779

Cursor 782System 782

Aggregation 784Checksum 785Conversion 786Cryptographic 786Cursor 787

Image/Text 790Mathematical 790Metadata 792Ranking 794Rowset 794Security 795

Trang 35

xxxiii

Trang 37

were simple, accompanied by the short but effective slogan “OLAP for the masses.” For the most part that mission hasn’t changed over the years We’ve simply focused on different aspects of the product that would deliver us the “masses.”

In the early years, our focus and mission were to ensure that our technology was easy to use, didn’t require much consulting (relative to what was required at the time in the market), and yes, was cheap The idea was to make the technology accessible to as many companies as possible The other element of the strategy was to make the solution a platform play and build a healthy ecosystem around our BI offering

Indeed, in the early years we set out to build a server with strong capabilities, with a rich set of APIs and query language (MDX) We also built a thriving ecosystem of partners

Results were seen quickly The SQL OLAP Server, later known as SQL Server Analysis Services, became the most widely used OLAP Server in the world, a title the product still holds today

Witnessing the market adoption of and reaction to the Analysis Services server, we began our ond act by offering something new and innovative for reporting solutions: SQL Server Reporting Services Its adoption surpassed our wildest expectations Overnight our user base grew by tens of millions of report consumers, who got their reports and insights from their IT departments Just like that, we took a giant step forward in reaching the masses we were after

sec-As more and more companies have begun using BI solutions, user sophistication has evolved Our users suddenly felt the power and value BI offers, and they wanted more of it However, they discov-ered that their IT departments could not address their demand, and they became a bottleneck

Viewing the problem as both an inhibitor and an opportunity to expand our reach and continue our mission of providing “BI for the masses,” we developed a set of tools PowerPivot was released in

2010, followed by Power View in 2012 They aimed to help information workers build their own BI solutions with what we called “managed self-service BI.” The self-service concept is easy to grasp: Build a tool that can be used by any information worker who has access to data so that he can build his own BI solution The managed aspect is more fundamental Even though we want to empower end users, IT wants to do so in a controlled and safe fashion IT wants to ensure that all critical data and apps are properly backed up, that the data is not stale, and that it is clear how the data is used and by whom

The change from developing a fi class platform for developers and IT pros to developing a fi class solution for information workers required a signifi cant change in how we design and build our software It required us to simplify the offering, reducing the technical knowledge users must have It required us to invest a lot in smart defaults so that users would not need to undergo training

Trang 38

have fun The only way a user will take the time to discover insights on his own is if he has fun with

the data

What I really like about Professional SQL Server 2012 Reporting Services is that it’s a perfect

refl ection of the Microsoft BI journey through the eyes of the Reporting Services product line, from

the early days of managed and operational to the latest addition of self-service reporting This book

was written by experts who built the product and have implemented it at customers’ sites Together

they have more than 40 years of business intelligence experience

I call this book the encyclopedia of SQL Server Reporting Services All the chapters have been

updated with the latest information to ensure accuracy and compatibility with the latest version of

SQL Server 2012 The book includes a new section that refl ects the addition of Power View with

PowerPivot You’ll learn how to best use the two together to refl ect the latest management

capabili-ties of Reporting Services in SharePoint

I hope you will enjoy reading this book and using SQL Server Reporting Services 2012 as much as

we, the product team, have enjoyed building the product

—Ariel Netz

Partner Group Program Manager SQL Server Reporting Services

Microsoft

Trang 39

released, back in 2003 After four new versions of Reporting Services, there have been four editions

of this book

We have learned a lot about report writing and report solution development from our experience with SSRS and other reporting tools, and we share the benefi t of that experience in this book Not only do we show you how to use this technology and tools to design reports as they were intended to

be used, but we also share the best practices and lessons we have learned along the way The authors have spent tens of thousands of hours using these tools to solve business problems for organizations

in many different industries and businesses

WHO THIS BOOK IS FOR

Some books are written specifi cally for beginners, and others are for serious developers and advanced report designers We’ve made it a point to address the needs of the many without sacrifi c-ing the needs of the few We wanted to write a book that would meet the needs of a broad audience, along with specifi c solutions for report designers, developers, administrators, and business profes-sionals Our goal is for this book to be a comprehensive guide and valuable reference To meet this objective, we’ve divided this book into parts — “mini-books,” if you will Depending on your needs, you may spend more time focusing on the material in one of these parts and using the others for reference This book is written for the novice report designer and the expert interested in learning

to use advanced functionality For the application developer, we cover programming in reports and custom applications that integrate reports You also learn about report server administration and security issues

We’ve come to know more about the people who use Reporting Services in various ways The ing sections describe people in different roles and the parts of the book that address their needs We’ve given these people names to make the examples more realistic Use these examples as a guide to fi nd the role that best describes your needs and the ways in which you will use Reporting Services

follow-Report Designer

Mary works in the fi nancial group for a company that provides consumer services She is a savvy worker who possesses a wide range of offi ce skills She has worked in this group for several years and could easily do her boss’s job She understands her company’s business processes, fi nancial reporting practices, invoicing, and billing systems She’s not a computer genius, but she knows her way around word processing, spreadsheets, e-mail, and simple database reporting Mary started using Microsoft Access a few years ago She used the wizards to create some simple reports from data

Trang 40

Mary’s focus is on out-of-the-box reporting — designing and deploying reports as easily as possible

using the tools readily available within the product She might end up designing standard

server-based reports that users will access from a central report server via the corporate intranet She may

also want to create her own ad hoc client-side reports from data models created by an administrator

or more advanced designer

The following parts of the book will be of most interest to Mary:

‰ Part I, “Getting Started”

‰ Part II, “Report Design”

‰ Part III, “Business Intelligence Reporting”

‰ Part IV, “Enabling User Reporting”

Application Developer

Joe has been writing database applications for several years A few years ago he began using Microsoft

.NET programming tools and landed a programming position in the company’s Information

Technology group Joe has designed many of the company’s web sites and portals using the Visual

Basic NET and C# programming languages Most of the reports Joe has created were written from

scratch as custom web pages He has worked a little with a few specialized reporting applications He

wants to add reporting capabilities to some of the company’s custom business applications

As far as Joe is concerned, writing simple reports is for others to do He’s more concerned with

add-ing functionality to a solution rather than dealadd-ing with business questions and aesthetic qualities

of reports His focus will likely be to add fi ltering, custom formatting, and conditional logic using

program code and query scripts He will also design his reports so that they fi t into applications as

an integrated part of a solution He may also want to create customized management utilities to

automate report server maintenance routines

Joe understands that Reporting Services offers many fl exible options for integrating reports into

dif-ferent application interfaces He may want to build reports into a custom Windows desktop

applica-tion, web applicaapplica-tion, SharePoint Portal, or mobile device application

Joe will be most interested in these parts:

‰ Part II, “Report Design”

‰ Part III, “Business Intelligence Reporting”

‰ Part V, “Solution Patterns”

‰ Part VII, “Reporting Services Custom Programming”

Ngày đăng: 14/03/2014, 09:20

TỪ KHÓA LIÊN QUAN