Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
BendJoe
Posting Yak Master
128 Posts |
Posted - 2007-10-05 : 12:21:10
|
| Hi I am trying to create a Stored Procedure which does a Search based on a parameter which is a text entered by the user. I am using this in the where clauseWHERE (ADDRESS_STREET = @Search)OR (ADDRESS_STREET LIKE @Search) OR (ADDRESS_STREET LIKE @Search + '%') OR (ADDRESS_STREET LIKE '%' + @Search) OR (ADDRESS_STREET LIKE '%' + @Search + '%')Suppose if a person mistypes Street as Stret then this procedure will not give the desired result. What is the best search criteria in these kind of search.The purpose of the search in my application is to counter mis-spelled addresses. Please help. |
|
|
blindman
Master Smack Fu Yak Hacker
2365 Posts |
Posted - 2007-10-05 : 12:43:27
|
First, you current logic could be reduced to simply:WHERE (ADDRESS_STREET LIKE '%' + @Search + '%') ...but from your description, you need a fuzzy-search algorithm such as this: http://sqlblindman.googlepages.com/fuzzysearchalgorithme4 d5 xd5 Nf6 |
 |
|
|
|
|
|