Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.
No Functions on Left Side of Operator
From Wiki
Don’t use functions on a column in the where clause
You will get an index scan instead of a seek, take a look these two queries. The first query uses a function while the second does not and is therefore sargable
- SELECT * FROM Orders WHERE LEFT(CustomerID,1) ='V'
- SELECT * FROM Orders WHERE CustomerID LIKE 'V%'
Here is the execution plan
Contributed by: --SQLDenis 15:24, 31 May 2008 (GMT)
Part of SQL Server Programming Hacks - 100+ List
Section Query Optimization




LTD Social Sitings
Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.