O'Reilly logo

Defensive Database Programming with SQL Server by Alex Kuznetsov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 2. Code Vulnerabilities due to SQL Server Misconceptions

In Chapter 1, we discussed several examples where we could choose whether to ensure that an assumption that underpinned our code implementation was always true, or to eliminate that assumption, if possible. However, certain vulnerabilities occur due to a basic misunderstanding of how the SQL Server engine, or the SQL language, work. Such vulnerabilities should always be eliminated, or they will ultimately lead to code failure.

This chapter will discuss the following three, very common, misconceptions:

  • WHERE clause conditions will always be evaluated in the same order – a common cause of intermittent query failure

  • SET and SELECT always change the values of variables – this false assumption ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required