Professional Microsoft SQL Server 2008 Programming
Published by
Wiley Publishing, Inc .
10475 Crosspoint Boulevard
Indianapolis, IN 46256
www.wiley.com
Copyright 2009 by Wiley Publishing, Inc., Indianapolis, Indiana
Published simultaneously in Canada
ISBN: 978-0-470-25702-9
Vieira, Robert.
Professional Microsoft SQL server 2008 programming / Rob Vieira.
p. cm.
Includes index.
ISBN 978-0-470-25702-9 (paper/website)
1. SQL server. 2. Client/server computing. 3. Database management. I. Title.
QA76.9.C55V535 2009
005.7585dc22
2009010578
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 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 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.
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 affiliates, 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 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.
Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic books.
This book is dedicated with all my heart to Ashley , Addy , and Anna . It's hard to believe that Ashley was still in elementary school when I wrote my first book (she'll graduate from college later this year) and didn't have to share this dedication with other kids (heck, she isn't much of a kid anymoreeeek!). Then there's Addy, who literally dreads me writing, yet continues to put up with me disappearing into my home office during the lengthy period of time I work on a book. Finally, there's Anna, who came in the middle of this round of writing, and didn't have any real history on what to expect from my writing disappearances.
A dedication of this book would most certainly not be complete without a particularly special thank you to Deb , who has leveraged my efforts in this and my recent Beginning title to redefine for me what the terms love and support mean.
As I've said for many releases now, I wish Wrox would let me print a picture of the women in my life on the cover of this book rather than my ugly mugI'm certain that you, the reader, would appreciate it too!
About the Authors
Experiencing his first infection with computing fever in 1978, Rob Vieira knew right away that this was something really cool. In 1980 he began immersing himself into the computing world more fullysplitting time between building and repairing computer kits, and programming in BASIC as well as Z80 and 6502 assembly. In 1983, he began studies for a degree in Computer Information Systems, but found the professional mainframe environment too rigid for his tastes and dropped out in 1985 to pursue other interests. Later that year, he caught the PC bug and began the long road of programming in database languages from dBase to SQL Server. Rob completed a degree in business administration in 1990 and since has typically worked in roles that allow him to combine his unique knowledge of business and computing. Beyond his bachelor's degree, he has been certified as a Certified Management Accountant (CMA); Microsoft Certified as a Solutions Developer (MCSD), Trainer (MCT), and Database Administrator (MCDBA); and even had a brief stint certified as an Emergency Medical Technician (EMT).
Rob is currently the Database Team Lead for Stockamp, a Huron Consulting Group practice. He has published six books on SQL Server development
He resides in Vancouver, Washington, where he does his best to take care of his girls, and even takes his best shot at letting Deb take care of him some too.
Credits
Executive Editor
Bob Elliott
Development Editor
Sydney Jones
Adaobi Obi Tulton
Technical Editor
John Mueller
Production Editor
Daniel Scribner
Copy Editor
Kim Cofer
Editorial Manager
Mary Beth Wakefield
Production Manager
Tim Tate
Vice President and Executive Group Publisher
Richard Swadley
Vice President and Executive Publisher
Barry Pruett
Associate Publisher
Jim Minatel
Project Coordinator, Cover
Lynsey Stanford
Proofreader
Publication Services, Inc.
Indexer
Robert Swanson
Acknowledgments
Nearly a decade has gone by since I finished my first book on SQL Server, and the list of those deserving some credit continues to grow.
As always, I'll start with my kids . They are the ones who most sacrifice time when a new release comes along and I spend so much time writing.
Deb This was the first time she had to deal with one of my writing cycles, and she couldn't have done anything more to make me feel more supported. Deb has helped me redefine the meaning of the word support. She is my rock.
You the readers. You continue to write me mail and tell me how I helped you out in some way. That continues to be the number one reason I find the strength to write another book. The continued support of my Professional series titles has been amazing. We struck a chordI'm glad. Here's to hoping we help make your SQL Server experience a little less frustrating and a lot more successful.