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.”

No Comments - Leave a comment

Leave a comment

Your email address will not be published. Required fields are marked *








Calendar
June 2010
M T W T F S S
« May   Jul »
 123456
78910111213
14151617181920
21222324252627
282930  
Content
SQLHelp

SQLHelp

  • @SQLSoldier: @sqlboyarick Depends on storage. Multiple physical devices > 1 physical device > 1 physical device split up into multiple devices. #sqlhelp
  • @SQLSoldier: @IT_fas Those 2 things are mutually exclusive. http://t.co/QCwltewLdm #sqlhelp
  • @IT_fas: #sqlhelp: getting error 1418 when trying to configure db mirroring. Any idea. have done everything that is needed but still not working?
  • @sqlboyarick: #sqlhelp do you think very large databases are better off on one really big array or several files on different disks?
  • @bradk2127: #sqlhelp SSIS-get 1 column from Oracle table, multiple columns from diff Oracle table and load data into an oracle table - which transform?
  • @_dave705: @SqlrUs Sure, also the requirement is to update the existing rows once the import starts. #sqlhelp the are 4 different csv files to import.
  • @SqlrUs: @_dave705 BCP is an option, again depends on the requirements. I would test thoroughly first before deploying to Production. #sqlhelp
  • @__mandrew__: @SqlrUs @_dave705 I agree SSIS with a foreach loop is probably your best solution. PowerShell would work if u have the skillset. #sqlhelp
  • @SqlrUs: @_dave705 Depends. SSIS would be my first choice. Might be best to post a question on a forum & provide a link here. #sqlhelp
  • @RumblingDBA: Has anyone seen Logbuffer wait on SSD's? Can anything be done regarding it? I did not expect that wait on SSD #SQLHelp

Welcome , today is Tuesday, September 1, 2015