How to use Soundex and Like in a single query ?

  • Hai,

    I would like to use soundex() function in my application for which sql is fetching only the records starts with the given condition but I need the middle one also. for example

    If i want to search all the books sounds like 'combuterrr' means sql is fetching only those starting word with 'computer' but i need to fetch in the middle also (ie 'graphics in computer' also).

    I tried with 'Like' Operator, but i do know how to combine 'Like' and 'Soundex'

    How to use Soundex and Like in a single query ?

    or

    Is there any other method please write to me.

    thanks

    S.Vijay Krishnan

    mail id : s_v_krishnan@rediffmail.com

  • Cannot do this will soundex as it translates the whole phrase in the column and not the words. You could however right a procedure that looped thru all the words in a column and took care of this. Or create a column with each words soundex version seperated out and did a SELECT * from tblX WHERE soundsCol LIKE '%' + Soundex('value') + '%' but I have not tested this.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

  • Check this query to get a view on what soundex is doing :

    select 'bijnens', soundex('bijnens')

    union all

    select 'bainens', soundex('baainens')

    union all

    select 'beinens',soundex('beinens')

    union all

    select 'beijnens', soundex('beijnens')

    union all

    select 'bynens', soundex('bynens')

    union all

    select 'bijnans', soundex('bijnans')

    union all

    select 'bijkans', soundex('bijkans')

    union all

    select 'janssen', soundex('janssen')

    union all

    select 'janssens', soundex('janssens')

    union all

    select 'jansen', soundex('jansen')

    union all

    select 'jans', soundex('jans')

    union all

    select 'sjans', soundex('sjans')

    union all

    select 'chans', soundex('chans')

    Pick your opinion regarding phonetics.

    Jobi

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • Does this work at all...

    Select *

    From Table

    Where

    (

    Soundex('combuterrr') = Soundex(ColumnName) or

    ColumName Like '%computer%'

    )

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply