Monday, March 26, 2012

easy question... i think

I have a ASP page where the user posts part of the name field. Then i need to provides the matches. (providing partial comparision of the field & correcting bad spelling)

example:

User posts 'softwair' (should be software)

the query look like this
Select Name from A where Name is like '%softwair%' <-- but appling soundex on it in the like field, or something like it.

I could make a copy of the column and update all info in the field to the soundex value, but then the like statement would not get it if the value was only part of it. for example say the data values where like 'Microsoft Software', or 'My Software Solutions', ect...You don't need to "update" the column to the soundex result, just create a computed column that would use soundex(field_name) as a function. But this will only answer the misspelling question.

select soundex('software'), soundex('softwair')

results in 'S136' for both.

No comments:

Post a Comment