Tags: Professional Book Review

Defensive Db Programming Chapter 02

This is the review of the second chapter of the book Defensive Database Programming.  The title of this chapter is “Code Vulnerabilities Due to SQL Server MisConceptions.”

This chapter examines three common misconceptions:

  1. WHERE clause conditions will always be evaluated in the same order
  2. SET and SELECT always change the values of variables
  3. Data will be returned in some “natural order”

Another misconception is that DBAs and Developers know these misconceptions.  As frequently as we are reminded of these things, it is not enough and we need to continue to remind ourselves about these misconceptions as well as teach others the same thing.

As was shown in the first chapter, we have been given some samples of how these statements are proved invalid.  Due to the proof of the misconception, we are also given some alternatives to code against them.

This is the kind of information that should be required reading for anybody who needs to write a stored procedure or a script that touches a database.  Even for seasoned professionals, the samples laid out in this chapter need to be examined.  I think most of us could find an application in our current environments where we could apply these principles right away.

In this chapter we also see another use for the “Numbers” table.  This chapter is also rather easy to read and written well.  I hope you enjoy reading it as well.

Defensive Database Programming Chapter 01

Today I am finally getting around to the review of the first chapter as promised.  I talked about the book a bit in the first post on the subject, which can be found here.  This book was written by Alex Kuznetsov (blog).

In this chapter, Alex discusses some basic defensive programming techniques.  That, in fact, is essentially the name of the chapter.  This is a pretty lengthy chapter – and with good reason.  Alex is laying the groundwork in this chapter with some basic samples and pretty much giving an introduction to the book.  The code samples are straight forward and designed to illustrate his point quite well.

During my current reading, a good takeaway from this chapter is the discussion on Rowcount.  For me, it serves as a prime reminder of the deprecation status as of SQL Server 2008.  If you are using SET ROWCOUNT, stop and change your practices.  Alex suggests using TOP in lieu of SET ROWCOUNT.

With each case that Alex presents as a potential problem when building your SQL code, he offers up a solution on how to avoid that problem.  The composition of using problems and providing solutions is quite handy.

And in Alex’s own words (Chapter 1 Summary, Page 59)

“It is vital that you understand and document the assumptions that underpin your implementation, test
them to ensure their validity, and eliminate them if they are not.”

SQL Book Review

Categories: News, Professional
Comments: 5 Comments
Published on: May 21, 2010

Recently I received a new opportunity via email.  Steve Jones at SQLServerCentral sent me an email to see if I would be interested in helping review a book and write about it on my blog.  I told Steve I would be happy to help out.

The book is titled Defensive Database Programming and is currently available at RedGate.  This book was authored by Alex Kuznetsov and is 10 chapters long and376 pages.  I will be writing between 1 and 10 articles concerning this book.  I would like to dive into the book and check things out and give it a good fair shake.

After reading the author Bio, I added Alex to my blog roll.  I added him if for nothing more than he runs Ultra marathons and is a SQL Server database guy.  You can find Alex’s blog here.

One last tidbit for now, the book had a technical review performed by Hugo Kornelis.

«page 2 of 2
Calendar
May 2012
M T W T F S S
« Apr    
 123456
78910111213
14151617181920
21222324252627
28293031  
Follow me on Google+

In 0 people's circles

Add to circlesi
Content
Categories

Categories

Now Reading

Now Reading

Planned books:

Current books:

  • ChiRunning: A Revolutionary Approach to Effortless, Injury-Free Running

    ChiRunning: A Revolutionary Approach to Effortless, Injury-Free Running by Danny Dreyer, Katherine Dreyer

  • Advanced Marathoning – 2nd Edition

    Advanced Marathoning – 2nd Edition by Peter Pfitzinger, Scott Douglas

  • SQL Server MVP Deep Dives

    SQL Server MVP Deep Dives by Nielsen Paul, Delaney Kalen, Machanic Adam, Tripp Kimberly, Randal Paul, Low Greg

  • A World Without Heroes (Beyonders)

    A World Without Heroes (Beyonders) by Brandon Mull

Recent books:

View full Library

SQLHelp

SQLHelp


Welcome , today is Thursday, May 17, 2012