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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Slight Difficult Phonetic Search

Author  Topic 

ladak
Starting Member

13 Posts

Posted - 2010-09-07 : 06:02:37
Hi all,

I have a table with field Name 'TradeMark'
I have more then 200,000 records in table,
i want to search "Exide" in this field and there are some similar phonetic words inside like "Xide", "Xside" etc, i am looking for function or query to search all these words when i enter "Exide" or "xide" or "xside", there are so many similar phonetic words that i want to search. Before providing me any solution please check it out on this "Exide" example that your function or query should search all these 3 names.

Please help me out.

Thanks
Ladak

Kristen
Test

22859 Posts

Posted - 2010-09-07 : 09:02:48
For Trademark wouldn't you be better off using a Trademark search site? A Trademarks with, for example, all letters reversed may be treated as a match- let alone Exide and XSide etc. - and a proprietary Trademark / Intellectual Property search site will have all those "nuances" built in
Go to Top of Page

ladak
Starting Member

13 Posts

Posted - 2010-09-08 : 04:17:09
I have my own database in which i have to search. Thanks
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-09-08 : 06:21:36
Well you'll have to reinvent the wheel for the search algorithm then. I doubt you will be able to do this directly in SQL, although there may be algorithms like Levenshtein - but they usually do not translate well to efficient SQL
Go to Top of Page

blindman
Master Smack Fu Yak Hacker

2365 Posts

Posted - 2010-09-08 : 12:38:00
Use this fuzzy-search algorithm:

create function CompareText (@String1 varchar (50), @String2 varchar (50))
returns integer
--Function CompareText
--blindman 4/2005, Adapted from MS Access algorithm developed 1997
--Returns value between 0 and 100 indicating the similarity between two character strings.
--usage: select * from [Table] where dbo.CompareText([ColumnValue], 'SearchString') > 80
----blindman, 6/5/2008: Added space before strings to improve accuracy.

begin
--Test parameters
-- declare @String1 varchar(50)
-- declare @String2 varchar(50)
-- set @String1 = 'Bruce Alan Lindman'
-- set @String2 = 'Lindman, Bruce Alan Sr.'

declare @Possibles integer
declare @Hits integer
declare @Counter integer

set @String1 = ' ' + ltrim(rtrim(@String1))
set @String2 = ' ' + ltrim(rtrim(@String2))

set @Possibles = len(@String1) + len(@String2) - 2
set @Hits = 0

set @Counter = len(@String1)-1
while @Counter > 0
begin
if charindex(substring(@String1, @Counter, 2), @String2) > 0 set @Hits = @Hits + 1
set @Counter = @Counter - 1
end

set @Counter = len(@String2)-1
while @Counter > 0
begin
if charindex(substring(@String2, @Counter, 2), @String1) > 0 set @Hits = @Hits + 1
set @Counter = @Counter - 1
end

return (100*@Hits)/@Possibles
--select (100*@Hits)/@Possibles

end


________________________________________________
If it is not practically useful, then it is practically useless.
________________________________________________
Go to Top of Page

Rich_z7
Starting Member

5 Posts

Posted - 2010-10-05 : 11:15:40
Hi,

If you haven't got a work around already, check out the SOUNDEX algorythm. This is actually available in Transact-SQL using the SOUNDEX() function

Regards

Rich
Go to Top of Page
   

- Advertisement -