Fuzzy string matching
When searching for strings in SQL Server using =, the strings must match exactly for the expression to evaluate to true. If we want to match only part of the string however, we must use a LIKE operator with wildcards. If we want to search for a pattern anywhere within a string, we need both leading and trailing wildcards. The problem with this is that it prevents us from being able to use an index or accurately estimate the cardinality . An index with a string key is sorted, starting with the first character of the string, but if we are searching for a pattern that may appear in the middle of the string, SQL Server must scan every value and search for the matching pattern in each string in the column. A LIKE operator ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access