30610 00 p ab i-xxxviii r5j.ps 6/3/04 4:58 PM Page i Praise for AFirst Look at SQLServer 2005 for Developers “If you want to be the best at developing applications for SQLServer 2005, you need to read this book. This book is the Rosetta Stone of SQLServer programming.” —Eric Brown SQLServer Program Manager Microsoft Corporation “I’m glad to see that users will have a great book on SQLServer 2005 with great ADO.NET 2.0 coverage available right when the product hits the streets.” —Pablo Castro Program Manager, ADO.NET Team Microsoft Corporation “An excellent book for people who want to delve deep into the newest features of SQL Server and understand the vision behind the design. Being close to the development process from early stages, theauthors were able to obtain unique knowledge about the product and they are passing it on to you.” —Alexander Vaschillo Microsoft Product Manager Father of the three-part data model mapping Microsoft Corporation “This book clearly explains the complex semantics behind Object Spaces API in an intuitive way.” —Dinesh Kulkarni Microsoft Product Manager, ObjectSpaces Microsoft Corporation 30610 00 p ab i-xxxviii r5j.ps 6/3/04 4:58 PM Page ii 30610 00 p ab i-xxxviii r5j.ps 6/3/04 4:58 PM Page iii A First Look at 2005 SQL Server for Developers 30610 00 p ab i-xxxviii r5j.ps 6/3/04 4:58 PM Page iv Microsoft .NET Development Series John Montgomery, Series Advisor Don Box, Series Advisor Martin Heller, Series Editor The Microsoft .NET Development Series is supported and developed by the leaders and experts of Microsoft development technologies including Microsoft architects and DevelopMentor instructors. The books in this series provide a core resource of information and understanding every developer needs in order to write effective applications and managed code. Learn from the leaders how to maximize your use of the .NET Framework and its programming languages. Titles in the Series Brad Abrams, .NET Framework Standard Fritz Onion, Essential ASP.NET with Library Annotated Reference, Volume 1, 0- Examples in C#, 0-201-76040-1 321-15489-4 Fritz Onion, Essential ASP.NET with Keith Ballinger, .NET Web Services: Examples in Visual Basic .NET, 0-201- Architecture and Implementation, 76039-8 0-321-11359-4 Ted Pattison and Dr. Joe Hummel, Bob Beauchemin, Niels Berglund, Dan Building Applications and Components Sullivan, AFirst Look at SQLServer 2005 with Visual Basic .NET, 0-201-73495-8 for Developers,0-321-18059-3 Chris Sells, Windows Forms Programming Don Box with Chris Sells, Essential.NET, in C#, 0-321-11620-8 Volume 1: The Common Language Runtime, Chris Sells and Justin Gehtland, 0-201-73411-7 Windows Forms Programming in Visual Mahesh Chand, Graphics Programming Basic .NET, 0-321-12519-3 with GDI+, 0-321-16077-0 Paul Vick, The Visual Basic .NET Anders Hejlsberg, Scott Wiltamuth, Programming Language, 0-321-16951-4 Peter Golde, The C# Programming Damien Watkins, Mark Hammond, Language, 0-321-15491-6 Brad Abrams, Programming in the .NET Alex Homer, Dave Sussman, Mark Environment, 0-201-77018-0 Fussell, AFirst Look at ADO.NET and Shawn Wildermuth, Pragmatic System.Xml v. 2.0, 0-321-22839-1 ADO.NET: Data Access for the Alex Homer, Dave Sussman, Rob Internet World, 0-201-74568-2 Howard, AFirst Look at ASP.NET v. 2.0, Paul Yao and David Durant, .NET 0-321-22896-0 Compact Framework Programming with C#,0-321-17403-8 James S. Miller and Susann Ragsdale, The Common Language Infrastructure Paul Yao and David Durant, .NET Annotated Standard,0-321-15493-2 Compact Framework Programming with Visual Basic .NET, 0-321-17404-6 For more information go to www.awprofessional.com/msdotnetseries/ 30610 00 p ab i-xxxviii r5j.ps 6/3/04 4:58 PM Page v A First Look at 2005 SQL Server for Developers Bob Beauchemin Niels Berglund Dan Sullivan Boston • San Francisco • New York • Toronto • Montreal London • Munich • Paris • Madrid Capetown • Sydney • Tokyo • Singapore • Mexico City 30610 00 p ab i-xxxviii r6jm 8/17/04 3:59 PM Page vi Many of the designations used by manufactur- Library of Congress Control Number: ers and sellers to distinguish their products are 2004107765 claimed as trademarks. Where those designa- tions appear in this book, and Addison-Wesley Copyright © 2004 by Pearson Education, Inc. was aware of a trademark claim, the designa- tions have been printed with initial capital let- All rights reserved. No part of this publication ters or in all capitals. may be reproduced, stored in a retrieval system, or transmitted, in any form, or by any means, The authors and publisher have taken care in electronic, mechanical, photocopying, record- the preparation of this book, but make no ex- ing, or otherwise, without the prior consent of pressed or implied warranty of any kind and the publisher. Printed in the United States of assume no responsibility for errors or omis- America. Published simultaneously in Canada. sions. No liability is assumed for incidental or consequential damages in connection with or For information on obtaining permission for arising out of the use of the information or pro- use of material from this work, please submit a grams contained herein. written request to: The publisher offers discounts on this book when Pearson Education, Inc. ordered in quantity for bulk purchases and spe- Rights and Contracts Department cial sales. For more information, please contact: 75 Arlington Street, Suite 300 Boston, MA02116 U.S. Corporate and Government Sales Fax: (617) 848-7047 (800) 382-3419 [email protected] ISBN: 0-321-18059-3 Text printed on recycled paper For sales outside of the U.S., please contact: 2 3 4 5 6 7 8 9 10 11—CRS—0807060504 Second printing, September 2004 International Sales (317) 581-3793 [email protected] Visit Addison-Wesley on the Web: www.awprofessional.com 30610 00 p ab i-xxxviii r5j.ps 6/3/04 4:58 PM Page vii From Bob Beauchemin: To Mary, whose patience when I go into writing mode and “disappear” istruly remarkable From Niels Berglund: To Sarah, for her unwavering support and inspiration. I couldn’t have done it without you. From Dan Sullivan: For Alberta, the light of my life 30610 00 p ab i-xxxviii r5j.ps 6/3/04 4:58 PM Page viii 30610 00 p ab i-xxxviii r5j.ps 6/3/04 4:58 PM Page ix Contents Foreword Roger Wolter xxi Foreword Andy Gammuto xxv Foreword Roger Doherty xxvii About the Authors xxix Preface xxxi Acknowledgments xxxvii 1 Introduction 1 The .NET Runtime and the Microsoft Platform 1 .NET’s Effects on SQLServer 3 The SQL: 1999 Standard—Extending the Relational Model 8 User-Defined Types and SQLServer 10 XML—Data and Document Storage 13 Web Services—XMLas a Marshaling Format 19 SQLServer as an XMLRepository and Web Service Server 20 Client Access—And Then There Are Clients 20 Client-Side Database APIs and SQLServer 2005 20 Client-Side XML-Based APIs and SQLServer 2005 Integration 22 ObjectSpaces—Objects on the Middle Tier or Client 23 ix