MASTERING SQL Server ® 2008 Lee Bieker Harness the Powerful New Features of SQL Server 2008 Whether you’re a database administrator or application developer, this in-depth guide is your key to delivering improved data collection, storage, re- porting, and security with SQL Server 2008. Mastering SQL Server 2008 brings you up to speed on architecture, installation, and confi guration essentials, before moving to the step-by-step instruction you need for more advanced topics such as procedural programming, query optimization, how to use spatial data, SQL Server in the .NET world, and more. You’ll master the extensive toolset, explore useful third-party tools, and most importantly, fi nd out how to choose and use the right SQL Server features for the specifi c tasks you have. COVERAGE INCLUDES: • Installing and confi guring SQL Server 2008 • Understanding SQL Server’s place within the Microsoft architecture • Making data reliably and effi ciently available to your consumers • Securing your data with SQL Server 2008’s new Transparent Data Encryption feature • Integrating XML technology into SQL Server • Creating index architectures for maximum benefi t and minimum cost • Exploring new geometry and geography data types for today’s businesses • Maximizing data warehousing and business intelligence tools Master the New Features of SQL Server 2008 Migrate Smoothly from Other Major RDBMS to SQL Server 2008 Discover Practical Tools and Techniques, Whether You’re a Developer or Administrator Implement and Optimize Security to Protect Your Data Resources Learn in the Context of Real-World Scenarios and Tasks ABOUT THE AUTHORS Michael Lee, MCT, MCITP, MCPD, SCJP, has been teaching SQL Server since 1995. Over the last 13 years, Michael has provided training and consulting services in SQL Server and Enterprise Data Architecture to companies across the U.S. and Europe. Gentry Bieker, MCT, MCITP, MCDBA, MCSE, has been a consultant, mentor, and trainer since 1998. He has been architecting, developing, and administering SQL Server databases since version 6.0. www.sybex.com ISBN 978-0-470-28904-4 CATEGORY COMPUTERS/Database Management/General $59.99 US $65.99 CAN SERIOUS SKILLS. Microsoft ® SQL Server ® 2008 MASTERING Michael Lee Gentry Bieker Install, Confi gure, and Manage SQL Server 2008 Optimize, Troubleshoot, and Secure Your Database Microsoft ® 89044ffirs.indd 8 12/3/08 12:28:41 AM Mastering SQL Server ® 2008 89044ffirs.indd 1 12/3/08 12:28:28 AM 89044ffirs.indd 2 12/3/08 12:28:33 AM Mastering SQL Server ® 2008 Michael Lee Gentry Bieker 89044ffirs.indd 3 12/3/08 12:28:39 AM Acquisitions Editor: Agatha Kim Development Editor: Laurene Sorensen Technical Editor: Acey Bunch Production Editor: Christine O’Connor Copy Editor: Kathy Grider-Carlyle Production Manager: Tim Tate Vice President and Executive Group Publisher: Richard Swadley Vice President and Publisher: Neil Edde Book Designer: Maureen Forys, Happenstance Type-O-Rama; Judy Fung Compositor: Jeffrey Lytle, Happenstance Type-O-Rama Proofreader: Scott Klemp, Word One Cover Designer: Ryan Sneed Cover Image: © Pete Gardner / Digital Vision / Getty Images Copyright © 2009 by Wiley Publishing, Inc., Indianapolis, Indiana Published simultaneously in Canada ISBN: 978-0-470-28904-4 No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechan- ical, 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 per- mission 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 accu- racy or completeness of the contents of this work and specifically disclaim all warranties, including without limitation warranties of fitness 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 or to obtain technical support, please contact our Customer Care Department within the U.S. at (800) 762-2974, outside the U.S. at (317) 572-3993 or fax (317) 572-4002. Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic books. Library of Congress Cataloging-in-Publication Data Lee, Michael. Mastering SQL server 2008 / Michael Lee, Gentry Bieker. — 1st ed. p. cm. Includes index. ISBN 978-0-470-28904-4 (paper/website) 1. Client/server computing. 2. SQL server. 3. Relational databases. I. Bieker, Gentry. II. Title. QA76.9.C55L45 2009 005.75’85—dc22 2008042924 TRADEMARKS: Wiley, the Wiley logo, and the Sybex logo are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates, in theUnited Statesand other countries, and may not be used without written permission. SQL Server is a registered trademark of Microsoft Corporation in the United States and/or other countries. All other trademarks are the property of their respective owners. Wiley Publishing, Inc., is not associated with any product or vendor mentioned in this book. 10 9 8 7 6 5 4 3 2 1 89044ffirs.indd 4 12/3/08 12:28:39 AM Dear Reader, Thank you for choosing Mastering SQL Server 2008. This book is part of a family of premium- quality Sybex books, all of which are written by outstanding authors who combine practical experience with a gift for teaching. Sybex was founded in 1976. More than thirty years later, we’re still committed to producing con- sistently exceptional books. With each of our titles we’re working hard to set a new standard for the industry. From the paper we print on, to the authors we work with, our goal is to bring you the best books available. I hope you see all that reflected in these pages. I’d be very interested to hear your comments and get your feedback on how we’re doing. Feel free to let me know what you think about this or any other Sybex book by sending me an email at n e d d e @ w ile y.co m, or if you think you’ve found a technical error in this book, please visit http://sybex.custhelp.com. Customer feedback is criti- cal to our efforts at Sybex. Best regards, Neil Edde Vice President and Publisher Sybex, an Imprint of Wiley 89044ffirs.indd 5 12/3/08 12:28:40 AM To our students, who forced us to continually improve. 89044ffirs.indd 6 12/3/08 12:28:40 AM Acknowledgments Every project of this size is always an intense collaboration. This was certainly no exception. It all starts with the wonderful team at Sybex. This is the seventh project that I have worked on with the Sybex team, and I am always impressed by the work that they do. Special thanks to Neil Edde, Pete Gaughan, and Agatha Kim for their magnificent work on managing this pro- cess. Thanks also to our editor, Laurene Sorensen, who was able to merge our ideas together and help us to make the technical content actually readable. And thanks to the production team of Christine O’Connor, Kathy Grider-Carlyle, and Scott Klemp. Acey Bunch was a spectacular technical editor; an accomplished author in his own right, he provided many insights on the content that proved invaluable and substantially improved the quality of the content. Gentry Bieker, my coauthor on this project, was able to really capture the essence of SQL Server in the real world, something with which he has extensive experience. The production team at Sybex is superb. They were even able to take my hand drawings and turn them into real graphics, a true feat if you have ever seen my handwriting. Finally, on a personal note, my career in training and technology would never have taken off had it not been for a former mentor, Bob Taylor. Other colleagues including Jon Hansen, Dale Byrd, Bryan Bechtoldt, Ken Sandlin, and Mike Mansfield have contributed so much to my career and given me amazing support over the years. Additionally, most of this work was written while I was employed at Aristocrat Technologies in Las Vegas, and I need to thank my colleagues and the management there for their support and input. And of course, I need to offer special thanks to my family, my wife and son, who always pay the highest price for these proj- ects as I lock myself into the office every weekend to write. They have been incredibly support- ive as the process continued week after week, and I could not have done it without them. Most importantly, thanks to you, the reader. You are the reason for this project in the first place. I hope that you find value in the pages. Without you, we would not have had this incred- ible opportunity. Your feedback is invaluable and will help make any future projects better and more relevant. Good luck in your undertakings with SQL Server 2008. I wish you the best in your endeavors. —Michael Lee I’m incredibly thankful for the level of support I’ve received from everyone while writing my portion of this book. Thanks to Jennifer Hanner for all of the sacrifices she made, and the trips she allowed me to miss in order to complete this book, helping to keep me sane, and encourag- ing me to keep going through the process. To Samantha and Joel, my children, who went on many trips and outings without me through during the writing process. They made me smile, and reminded me that there is more to life than just a book. To Joel: “Yes, I’m finally done with my chapter!” To Michael Lee, who gave me this fantastic opportunity and introduced me to the process, and has always been patient and understanding in my learning about what it takes to put together a book of this size. Thanks to the entire book team: Laurene Sorensen, Acey Bunch, Pete Gaughan, Agatha Kim, and Neil Edde. I had an incredible amount of help and support from everyone I’ve encountered at Sybex and Wiley. You have all given me a ton of respect for the process that goes into creating a book. And to every one of my students (especially the dif- ficult ones), who helped me to make it to where I am today. —Gentry Bieker 89044ffirs.indd 7 12/3/08 12:28:40 AM 89044ffirs.indd 8 12/3/08 12:28:41 AM [...]... to: •u Use Architect SQL Server services in the typical IT environment •u Install SQL Server 2008 •u Use the Microsoft SQL Server toolset •u Implement other useful third-party tools SQL Server in the Enterprise World The authors of this book have been working with SQL Server for over a combined 28 years Back in the early days, it was a struggle to defend the product We came to SQL Server with the same... every chapter and provides a solution for each Appendix B: SQL Server Analysis Services Overview provides a high-level overview of the data warehousing and multidimensional tools in SQL Server 2008 Appendix C: SQL Server Reporting Services Overview provides a high-level overview of the business intelligence reporting tools included in SQL Server 2008 How to Contact the Authors We welcome feedback from... Overview of Microsoft SQL Server 2008 1 SQL Server in the Enterprise World 1 The Need for an Enterprise System 2 SQL Server Features 3 SQL Server s Place Within Microsoft Architecture 6 SQL Server Licensing ... full-text index management and performance enhancements If you haven’t at least played with Full-Text Search, you owe it to yourself to spend a few minutes getting cozy with it Business Intelligence Business Intelligence (BI) content is critical to the success of SQL Server 2008 The BI agenda for SQL Server 2008 was very aggressive One of the reasons that the schedule slipped for SQL Server 2008. .. Microsoft SQL Server 2008 This is another list that we could extend significantly, but our objective here was to give you a taste for the services available in SQL Server 2008, show you where some of the major enhancements fit, and provide a better framework for your own investigation and research We strongly recommend that you take the time to review the SQL Server 2008 feature documentation in the SQL Server. .. embedded to enterprise 89044c01.indd 6 12/3/08 12:30:30 AM | SQL Server in the Enterprise World 7 SQL Server Integration with Team Foundation Server One of the most extreme real-world examples of SQL Server integration in the Microsoft Architecture is Team Foundation Server This is a perfect case study in the prevalence of data and how SQL Server can provide data services whenever and wherever they... Foundation Server, he frequently uses a diagram similar to the one shown here to illustrate the architecture of Team Foundation Server Note the extensive use of SQL Server services in the diagram Team Systems Clients Team Portal Windows SharePoint Services ASP.NET Foundation Server Service Tier SQL Server Reporting Services Report Layer SQL Server Work Items Source Control Methodology SQL Server Analysis... This Book Our target audience is the database professional with some SQL Server experience who is either: •u Trying to ramp up skills on SQL Server 2008, or •u Transitioning from another RDBMS to SQL Server 89044flast.indd 23 12/3/08 12:29:49 AM xxiv | Introduction If you have read through the Microsoft marketing materials on SQL Server 2008 and would like to see what is under the hype, then this book... data and BI features SQL Server Services and Features The feature list for SQL Server is extensive Because we didn’t want to fill these pages with redundant information, we ask you to refer to the SQL Server Books Online There you will be able to find a great deal of information regarding the essential and expanded features of SQL Server 89044c01.indd 4 12/3/08 12:30:29 AM | SQL Server in the Enterprise... compression Chapter 10: Monitoring SQL Server Activity explains the various tools available for monitoring different types of SQL Server activity, including performance counters, SQL Profiler, DDL triggers, and event notifications An introduction to the Performance Data Warehouse/ Data Collector feature of SQL Server 2008 is also covered Chapter 11: Using the SQL Server Agent Service addresses creating . Architecture 6 SQL Server Licensing 8 Installing SQL Server 2008 10 Defining an Installation Plan 10 SQL Server 2008 Installation Requirements 16 The SQL Server. Cataloging-in-Publication Data Lee, Michael. Mastering SQL server 2008 / Michael Lee, Gentry Bieker. — 1st ed. p. cm. Includes index. ISBN 97 8-0 -4 7 0-2 890 4-4