Home Forums SQL Server 7,2000 T-SQL How to expand @variables in SQL Statement RE: How to expand @variables in SQL Statement

  • Agreed, simply is good and remember some basics. I think one of the options used a function on the column before testing ! Optimisers don't like this and are unlikely to utilise available indexes.

    Sometimes simple approaches look more verbose in terms of lines of code, but believe me, several months down the line having to support verbose but logical-to-read code is much less frustrating than trying to work out algorithms which were only there to save lines of code. Optimisers also like things simple !

    On a similar but different tack ...

    I had a developer mention that he was going to code a windows service to simply interrogate a column value and depending on the result, execute a stored proc. I suggested that he could use the job engine and he thought it was a great idea as it would save him coding ! A no-brainer I thought, but then SQL is my domain, vb asp .net etc is his. His idea was probably simple to him as was mine to me !

    Rick

    Learn principles, not syntax. Principles rarely change, methods on how to apply them are never static. You can look-up Syntax.