The Guru's Guide to SQL Server Stored Procedures, XML, and HTML

Paperback (Print)
Used and New from Other Sellers
Used and New from Other Sellers
from $1.99
Usually ships in 1-2 business days
(Save 97%)
Other sellers (Paperback)
  • All (22) from $1.99   
  • New (8) from $47.54   
  • Used (14) from $1.99   

Overview

"This is a book that deserves a prominent place by anyone who aspires to be a real professional developer of SQL Server applications."

--from the Foreword by Ron Soukup

The message of this book is that building stored procedures in Transact-SQL is very much like building programs in any other language. It requires the same type of skill, planning, attention to detail, and overall grasp of technology that successful development in other languages requires. To master Transact-SQL, one must first master the fundamental concepts of software development, then build on this foundation by embracing and studying Transact-SQL as a programming language in its own right. This book teaches you how to do that and more.

More than just a catalog of coding tricks and syntax subtleties, The Guru's Guide to SQL Server(TM) Stored Procedures, XML, and HTML explores the philosophy of Transact-SQL programming. It teaches readers how to apply this philosophy in order to develop their own coding techniques and discover their own solutions to real-world programming problems. A follow-up to the widely acclaimed The Guru's Guide to Transact-SQL, this book teaches that stored procedure development does not occur in a vacuum--it involves a wide variety of skills, subjects, and technologies--and helps the reader become a better software engineer, not just a stored procedure expert.

Blending theoretical detail with practical application, this comprehensive reference begins with a foundational overview of SQL Server(TM) stored procedure programming. From there, the focus moves on to best practices and design considerations before progressing to advanced topics and a general philosophy of software craftsmanship. In all, this book provides the most complete coverage of SQL Server stored procedure programming available in one source.

Topics such as user-defined functions, views, triggers, extended procedures, error handling, OLE Automation, database design, and XML are covered in detail. The book spotlights undocumented language features and brings the first application of design patterns to the SQL language. The preview of .NET and a groundbreaking approach to adding arrays to Transact-SQL make for the most thorough and engaging read published to date on SQL Server programming.

The accompanying CD-ROM contains the book's source code. More than 700 SQL scripts, programming utilities, and extended procedures provide a veritable treasure trove of high-quality example code.

Theoretically sound, yet immensely practical, The Guru's Guide to SQL Server(TM) Stored Procedures, XML, and HTML provides developers with the tools they need to become expert stored procedure programmers and better software engineers.

0201700468B11262001

Read More Show Less

Editorial Reviews

From Barnes & Noble
The Barnes & Noble Review
If you're an experienced SQL Server developer and you want to become a great one, here's your book: The Guru's Guide to SQL Server Stored Procedures, XML, and HTML. Chances are, you've already read (or at least heard of) Ken Henderson's classic The Guru's Guide to Transact-SQL. This is his long-awaited follow-up -- and it's been worth the wait.

Thought you couldn't implement arrays in T-SQL? Think again: Henderson shows you how. Never seen design patterns applied to T-SQL? Now you have -- and you'll be able to use these patterns from the get-go.

You'll find best practices and conventions for effective stored procedure development, debugging, profiling, and performance optimization, as well as expert techniques for creating triggers, views, and user-defined functions. The book includes a full section on using XML with SQL Server, covering queries, data retrieval, and the use of OPENXML, which allowing you to handle XML in relational database formats and pass XML documents to T-SQL stored procedures.

The CD-ROM brings together more than 600 code files: SQL scripts, programming utilities, extended procedures, database administration tools, and more. Between the code and the insights, T-SQL developers will find this book to be a gold mine. (Bill Camarda)

Bill Camarda is a consultant, writer, and web/multimedia content developer with nearly 20 years' experience in helping technology companies deploy and market advanced software, computing, and networking products and services. He served for nearly ten years as vice president of a New Jersey–based marketing company, where he supervised a wide range of graphics and web design projects. His 15 books include Special Edition Using Word 2000 and Upgrading & Fixing Networks For Dummies®, Second Edition.

From The Critics
Explores the nuances and quirks in SQL Server's stored procedure programming language, Transact-SQL. Written for advanced programmers, the book delves into the intricacies of database design, triggers, view objects, user-defined functions, extended storage procedures, and administrative storage procedures. The author also explains how to translate data stored in SQL Server databases into HTML and XML. The CD-ROM contains SQL scripts and programming utilities. Annotation c. Book News, Inc., Portland, OR (booknews.com)
Read More Show Less

Product Details

  • ISBN-13: 9780201700466
  • Publisher: Addison-Wesley
  • Publication date: 12/28/2001
  • Edition description: BK&CD-ROM
  • Pages: 800
  • Product dimensions: 7.38 (w) x 9.25 (h) x 1.49 (d)

Meet the Author

Ken Henderson, a nationally recognized consultant and leading DBMS practitioner, consults on high-end client/server projects for such customers as the U.S. Air Force, the U.S. Navy, H&R Block, Travelers Insurance, J.P. Morgan, the CIA, Owens-Corning, and CNA Insurance. He is the author of five previous books on client/server and DBMS development, a frequent magazine contributor to such publications as Software Development Magazine and DBMS Magazine, and a speaker at technical conferences.

0201700468AB07032003

Read More Show Less

Table of Contents

Preface.

Introduction.

I. THE BASICS.

1. Stored Procedure Primer.

2. Suggested Conventions.

3. Common Design Patterns.

4. Source Code Management.

5. Database Design.

6. Data Volumes.

II. OBJECTS.

7. Error Handling.

8. Triggers.

9. Views.

10. User-Defined Functions.

III. HTML, XML, AND .NET.

11. HTML.

12. Introduction to XML.

13. XML and SQL Server: HTTP Queries.

14. XML and SQL Server: Retrieving Data.

15. XML and SQL Server: OPENXML.

16. Introduction to .NET.

IV. ADVANCED TOPICS.

17. Performance Considerations.

18. Debugging and Profiling.

19. Automation.

20. Extended Stored Procedures.

21. Administrative Stored Procedures.

22. Undocumented Code.

23. Arrays.

V. ESSAYS ON SOFTWARE ENGINEERING.

24. Create a Workable Environment.

25. Make Small Changes.

26. Test Your Work.

Index. 0201700468T10152001

Read More Show Less

Preface

This is an advanced coder's book. Geared toward the intermediate-to-advanced developer, it is designed to help you reach the next level as a SQL Server stored procedure developer. This book assumes you already know how to write Transact-SQL queries and how to build stored procedures. This book offers little in the way of beginner-level instruction. It is aimed at developers with moderate-to-advanced skills who want to become better stored procedure programmers - developers who want to go to the next level of software craftsmanship as it relates to Transact-SQL, stored procedure programming, and XML.

The opening epigraph of my previous book, The Guru's Guide to Transact-SQL, is a quote by my friend, the renowned author and lecturer Joe Celko, regarding the importance of unlearning procedural programming in order to master non-procedural languages such as SQL. At the time, I agreed with Joe that writing Transact-SQL code in a procedural manner was the single biggest impediment to writing good Transact-SQL code. When I penned the first Guru's Guide book, I firmly believed that attempting to code in Transact-SQL in the same way that, say, C++ is written was the main reason that people who are competent developers in other languages often run into difficulties when they try to code in Transact-SQL. Their whole approach was wrong, I reasoned, and that's why they had problems. I believed that they weren't thinking like database programmers; that instead, they were thinking like traditional programmers, which just won't work in the world of database programming. So I thought.

Since then, I've had a change of heart. I once read an interview where Eddie Van Halen said that a band's music albums are snapshots of where the band is at a particular point in time (musically and otherwise). That's true of books, too. The Guru's Guide to Transact-SQL is where I was in 1998 and 1999 when I wrote it. Since then, my thinking on the relationship between procedural programming and Transact-SQL has evolved. Why? Well, let me tell you a little story...

Sometime during the two years I spent writing the first Guru's Guide, one of the book's technical reviewers wrote asking me about an article I'd written several years before for my column in Sybase Developer's Journal that demonstrated some tricks with bitmasks in Transact-SQL. He wanted to know if I could send him a copy of the article because he was doing some work with bitmasks and wanted to use one of the techniques I'd written about. I searched high and low for the article, but couldn't find it anywhere on the various computers I use. The machine on which I'd written the column had long since been retired, as had any backup tapes I might have had of it - if they had ever existed in the first place.

Finally, a search on the Internet turned up the ancient piece, and I forwarded it to the fellow who'd asked for it. With some amusement, I sat at my desk and read through the article for a few minutes (most writers really like to read what they write, no matter how old it is and no matter what they tell you). I wondered to myself: what ever possessed me to try these bit twiddling techniques in Transact-SQL of all things? Why do I think of things like this in the first place? I wondered what drove me to make discoveries like the techniques about which I'd written the article. I reasoned that if I could figure out how or why I went about making discoveries like this, perhaps I could unlock the secret of innovation itself, or, at least, how I occasionally stumble upon it. Perhaps I could move to the next level as a Transact-SQL coder myself.

I thought about it for a few days and finally realized why I came up with ideas like the bit-twiddling technique. The conclusion I came to was that, as much as I would have liked to have believed that I thought of them all on my own, many of my "discoveries" in Transact-SQL were due to what those in academia refer to as crosspollination. It was because of, not in spite of, my experiences with other languages that I'd come up with a number of the innovative coding techniques I'd discovered over the years. Most of the discoveries I'd made in Transact-SQL had grown from seeds planted in my brain by my work in traditional programming languages such as Pascal, C/C++, assembly language, and various others. It occurred to me that there were likely scant few true innovations originating in the relatively pubescent world of Transact-SQL programming. After all, languages like C and Pascal had pre-dated Transact-SQL by many years - languages like COBOL and BASIC by even longer. We don't see many new problems in the world of computing. What we see are new solutions to the same old problems. People were solving these problems long before Transact-SQL or SQL Server even existed. Surely, most of the discoveries to be made in the field of software engineering have already been made. Surely, those of us innovating in Transact-SQL are merely standing on the shoulders of the giants who came before us.

In their book, The Pragmatic Programmer (Addison-Wesley, 1999), Andrew Hunt and Dave Thomas make the bold recommendation that people who aspire to be better programmers should learn at least one new programming language per year. I'll make the same recommendation here. If you want to master Transact-SQL stored procedure programming, you should master programming itself first. Programming, coding, software engineering - whatever you want to call it - requires many years and many languages to master. Like the martial arts apprentice who must first master a number of separate martial arts before he can attain an advanced belt, a programmer who would master Transact-SQL should master the various aspects of programming in general before he can hope to master Transact-SQL itself.

The big-picture perspective and the cross-pollination that interdisciplinary work affords is the chief reason universities require schooling in fields outside of one's major focus of study. By studying the way that other fields do things, you see the many similarities and differences between your field and theirs, you gain deeper insight into those similarities and differences, and you learn to apply what you've discovered about topics completely outside your field to your own work in ways that have perhaps not been tried before. In other words, you learn to innovate. By embracing the broad view of the world the university espouses, you begin to understand your field more holistically - you begin to understand its philosophy more intimately, and you begin to grasp where it fits in the grand scheme of things.

I think the same kinds of insight can be gained through studying languages and techniques outside the realm of SQL Server. Were it not for my work in assembly language and my study of the works of masters like Steve Gibson, I might never have stumbled upon the bit twiddling techniques about which I wrote that ancient column. If not for my work in Pascal and Delphi and my study of code by gurus such as Anders Hejlsberg and Kim Kokkonen, I wouldn't have come up with a good number of the techniques I've developed in Transact-SQL over the years, including many of the data manipulation routines you'll see in this book. My research into common design patterns in Transact-SQL was inspired by the book Design Patterns by Erich Gamma and company, which I keep close at hand for my work in languages such as C++ and Object Pascal. The book The Practice of Programming, by Brian Kernighan and Rob Pike, has largely influenced my insistence on idiomatic programming. I'm a stickler for testing because of books like After the Gold Rush by Steve McConnell and Extreme Programming Explained by Kent Beck, and I'm a big proponent of the value of re-factoring because of works like Refactoring: Improving the Design of Existing Code by Martin Fowler. Many of the algorithms discussed in this book were inspired by those in Donald Knuth's three-volume work, The Art of Computer Programming and by Jon Bentley's book, Programming Pearls, as well as by many others.

None of these books are about Transact-SQL, per se, or even SQL Server. None of them demonstrate techniques that can be easily translated to a set-oriented language like SQL. They are, however, about programming, and my work in other languages is responsible for my knowledge of them. I have benefited - immensely - from interdisciplinary work - from the crosspollination between my work in Transact-SQL and my work in other languages and from the perspective such work affords a programmer. And I think you will, too.

So, rather than preaching that you must give up your sinful procedural programming ways in order to reach the nirvana that is Transact-SQL mastery, I will instead encourage you to explore other languages and other tools. Pick one per year - it can be any language or tool in which you're not already an expert - anything from Visual Basic to Delphi to Ruby to C#, C++, or Java. Come up with a few projects to undertake with your new language, ideally - but not necessarily - things that tie it back to SQL Server in some way, and then dive in. Buy the books you need, read the newsgroups, do the research, build your software. You will be surprised at how much you learn about programming, and how much you grow as a developer through the experience.

Then, sometime throughout these research projects, think about how you might apply what you're learning to your work as a Transact-SQL developer. How does SQL Server employ this or that language element that is featured by the tool you're studying? How does it implement functionality that you've found particularly helpful in your new language? How do they differ? How does, say, automation differ between Transact-SQL and Delphi? Given that Transact-SQL, like all of SQL Server, is written in C and C++, what language nuances can you trace to its origins?

After a few years of this, and after you've gained the perspective that forays into the world outside of SQL Server can afford, you will be well on your way to having the tools necessary to truly master Transact-SQL and stored procedure programming. You will appreciate software engineering as a discipline; you will love programming for its own sake.That is the key to mastering any programming language, including Transact-SQL.

So, my apologies to Joe Celko notwithstanding, I no longer believe that procedural programming is the single biggest impediment to good Transact-SQL coding. It is quite the opposite. Not truly grasping a language's strengths and weaknesses - the things that make it unique - is the single biggest impediment to building good software with it. And you can only gain the perspective necessary to accurately assess those strengths and weaknesses through interdisciplinary work and cross-pollination. In Transact-SQL's case, its strength is set-oriented development, its chief weakness is top-down programming. That doesn't mean that you can only write set-oriented programs with Transact-SQL or that writing procedural Transact-SQL code is only for the foolhardy. After all, they call them stored procedures for a reason. It just means that your style of coding will be different with Transact-SQL than it would be with, say, Visual Basic. That's not just true of Transact-SQL, it's true of many languages - many have nuances and idioms that make them unique. You wouldn't code in C++ the way you code in VB, either. Use the right tool for the job. Play to your tool's strengths and away from its weaknesses. Become intimate with those strengths and weaknesses by mastering not only the tool, but also software development in general. Purpose to become a master programmer, not just a stored procedure expert.

And about that conversation we had over dinner in San Francisco, Joe: I still think C# is the best thing to happen to programming in a good long while.

Ken Henderson
January 2001

0201700468P10152001

Read More Show Less

Customer Reviews

Average Rating 5
( 6 )
Rating Distribution

5 Star

(6)

4 Star

(0)

3 Star

(0)

2 Star

(0)

1 Star

(0)
Sort by: Showing all of 6 Customer Reviews
  • Anonymous

    Posted Fri Apr 30 00:00:00 EDT 2004

    Wish I'd had these books 5 years ago

    I own all three of Ken Henderson's SQL Server books. They stand apart from the rest of the crowd as the best books available on their respective subjects. Henderson takes a fresh approach to teaching that other authors would do well to emulate. What do I mean exactly? I mean this: Every point of any significance that is raised is illustrated with code when possible. There are hundreds of code examples in each of Henderson's books - many times what you usually see in DBA or programming books. No details are glosssed over. If you really want to know how something works or what the best approach is to doing something, you need these books. Another thing that is great about these books is how easy to read they are. Complex subjects are regularly broached with explanations and teaching that practically anyone could understand. Topics that trip up other authors or that they skip altogether are discussed in terms that anyone can grasp. It is difficult to convey just how important this is, but suffice it to say that the books are simply easy to read. If you want to know SQL Server at an expert level, you need look no further. Get all three of Henderson's books and read them cover-to-cover.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted Tue May 28 00:00:00 EDT 2002

    Another Great Book from Ken Henderson

    The book covers so many challenging subjects with such ease. It starts out with a primer on stored procedures. It devotes chapters to database design, triggers, views, UDF's, XML, and .NET, to list some of the topics. Once you read Mr. Henderson's book, you see there is so much to learn about SQL Server. I especially liked the chapter on UDF's. If you've ever searched for a better alternative to the builtin Soundex function, Mr. Henderson provides *the* best Soundex solution for SQL Server. In fact, that alone makes the book worthwhile. And let's not forget his listing and explanation of dozens of undocumented functions and features in SQL Server.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted Thu Jun 06 00:00:00 EDT 2002

    Guru's Guide to SQL Server Stored Procedures, XML, and HTML

    This book blew me away. From the 700+ code samples to the engaging prose, this is the best technical book I've ever found. Henderson deserves an award for this one - it's that good. Some high points: <P> - Production-quality example code - lot's of it <P> - Sage advice and commentary throughout <P> - Engaging prose and witty asides <P> - The chapter on .NET - no one has ever said it better <P> - The chapters on SQLXML - could be a book unto themselves <P> - The emphasis on treating Transact-SQL like a 'real' language -- a well thought out and reasoned argumented that pursuaded me and my entire team <P> - The Foreword by Ron Soukup - when I read that Foreword, I knew I had to have the book. I wasn't disappointed. <P> You can't go wrong with this one. Get it and get it today.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted Tue Jun 25 00:00:00 EDT 2002

    Guru's Guide to SQL Server Stored Procedures, XML, and HTML

    This book will challenge you to rethink your approach to developing in Transact-SQL. Henderson teaches that Transact-SQL is as a real a language as traditional languages such as C++ and VB and offers ample evidence to support this. He covers the whole gamut of the Transact-SQL programming spectrum -- from design patterns, to version control, to views, triggers, and UDFs, to xprocs, OLE Automation, and many others. He finishes up with a wonderful three-chapter set on his philosophy about software engineering as it relates to Transact-SQL programming. All in all, you won't find a better book on mastering the Transact-SQL language at any price.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted Thu Jan 17 00:00:00 EST 2002

    Great style and great content

    Ken Henderson's writing style is so natural and friendly. The book is quite an easy read, yet Mr. Henderson is able to convey some very technical content... While sharing stored procedures is almost always good - there are times when plan sharing can hurt performance. If you do not understand how to tell when plan sharing can be bad, Ken's book will get you up to speed. The second half of the book is related to XML and SQL Server/XML integration... If you are one of the many, many database guys out there who say 'I just don't get the XML thing.', then this book will be your guide.. Great job, Ken.!!

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted Fri Jan 25 00:00:00 EST 2002

    Guru's Guide to SQL Server Stored Procedures, XML, and HTML

    Ever since Sql Server 2K shipped I've been looking for the ultimate XML-on-Sql Server book. Now I have finally found it. I just spent the last week working from start to finish through the XML chapters and have gone from being a complete novice to pretty fair XML-SQL developer. I took some of the techiques the author shows and put in place in my work. Not only is the book instructive, the copious code samples have value apart from the book. All I can say is: thank you for writing this book. It was exactly what I needed.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing all of 6 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)