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
SELECT always change the values of variables – this false assumption ...