If I have a table like this…
create table #words (
id int identity,
word varchar(1024)
)
insert into #words (word) values ('dock')
insert into #words (word) values ('dockable')
and i do a LIKE query
select id, word from #words where word like '%dock%'
Is there a way to tell which result would be the most accurate?
For complex multi-word criteria you should use Full Text Search and
CONTAINSTABLE. The output of this table function contains aRANKcolumn:For simple single word criteria you should implement a Levenshtein distance function in SQL CLR and use that to find the most similar best match words (or use the one from Ken Redler’s linked project).