| How to
avoid using substring in a WHERE clause? |
|
Using substring
in a WHERE clause may cause table scan. That would be very slow
on a large table of millions of rows. In some cases the like matching
function can be used without causing table scan. Example:
Instead
WHERE SUBSTRING(ProductName,1,3) = 'net'
Try this
WHERE ProductName LIKE 'net%'
|
| Best in the World
in SQL Server Training |
|