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 |
|
thiruna
Starting Member
41 Posts |
Posted - 2002-11-27 : 20:01:44
|
| Just a clarification...!!!is it possible to search for a similar words for a word in sql 2000 server ?I mean, if we want to search for the word 'take', then sql server should return matching records containing terms like take, took, taken, taking etc....i know this is possible if we enable it to full text indexing. but is there a way to do the same without enabling full text indexing....many thanks in advancethiru |
|
|
rrb
SQLTeam Poet Laureate
1479 Posts |
Posted - 2002-11-27 : 22:53:16
|
Well, you could use the soundex function - from BOLSOUNDEX converts an alpha string to a four-character code to find similar-sounding words or names. The first character of the code is the first character of character_expression and the second through fourth characters of the code are numbers. Vowels in character_expression are ignored unless they are the first letter of the string. String functions can be nested.ExamplesThis example shows the SOUNDEX function and the related DIFFERENCE function. In the first example, the standard SOUNDEX values are returned for all consonants. Returning the SOUNDEX for Smith and Smythe returns the same SOUNDEX result because all vowels, the letter y, doubled letters, and the letter h, are not included.-- Using SOUNDEXSELECT SOUNDEX ('Smith'), SOUNDEX ('Smythe')Here is the result set:----- ----- S530 S530 (1 row(s) affected)but that would only help you with words with similar sounds - obviously not going to help you with "take-took"(So I'm not sure whether that's any help at all really and now I'm just embarrassed... )--I hope that when I die someone will say of me "That guy sure owed me a lot of money" |
 |
|
|
simondeutsch
Aged Yak Warrior
547 Posts |
Posted - 2002-11-28 : 15:30:13
|
| If you are looking for words sharing the same several characters/consonants, you can use PATINDEX with wildcards like this:select col from table where patindex('%t%k%',col1) > 0 if you are after words with a T and a K. Try running this in QA:create table #T (col1 char(10))insert #T (col1) values ('take')insert #T (col1) values ('cake')insert #T (col1) values ('taking')insert #T (col1) values ('plum')insert #T (col1) values ('took')insert #T (col1) values ('payment')insert #T (col1) values ('token')insert #T (col1) values ('thumbkin')insert #T (col1) values ('tank')insert #T (col1) values ('munk')insert #T (col1) values ('name')select col1 from #T where patindex('%t%k%',col1) > 0drop table #TSarah Berger MCSD |
 |
|
|
rrb
SQLTeam Poet Laureate
1479 Posts |
Posted - 2002-11-28 : 17:56:50
|
quote: take taking took token thumbkin tank
hmmmmmm....not quite an on-line thesaurus (which is what you want)He thirunaWhen you get a solution will you post it back??--I hope that when I die someone will say of me "That guy sure owed me a lot of money" |
 |
|
|
|
|
|
|
|