Store SOUNDEX value as VARCHAR and using CAST/CONVERT with DIFFERENCE?

  • Is it possible to store a SOUNDEX value of a word as say VARCHAR and then use cast/convert it for use in the DIFFERENCE function? If so, how?

    The table we have contains millions of rows and we would like to store the Soundex value and use this when querying instead of calling the soundex function everytime.

    Thanks

  • I am not sure what advantage this would have. What is your business rule or use case that would call for this?

    Storing a SOUNDEX is simple and can be done in a calculated column if you want.

    However, using the difference on that column would be troublesome. Mostly, because the DIFFERENCE function takes two strings, determines the SOUNDEX of each, and makes the comparison. So what you would end up with is the difference of the SOUNDEX's of both SOUNDEX values. That doesn't seem like it would be useful for a search.

    A search for the stored SOUNDEX values may speed things up if used properly. You would have to determine the SOUNDEX value of the search term up front though.

    Hope this helps.

Viewing 2 posts - 1 through 2 (of 2 total)

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