Numeric version of DIFFERENCE or SOUNDEX (posted in YUKON also)?

  • My situation is this.

    I need to check a table to see if a partnumber (varchar) exists in it. That's easy! But what if the value has two characters transposed?

    It appears to me that SOUNDEX and DIFFERENCE completely ignore numbers.

    I.E.

    select soundex('1644700809a'), soundex('5xreww332')

    will return '0000', '0000'

    -and-

    select difference('1644700809', '1644708009')

    will return 4 (when they are actually similar)

    If anyone can point me in the right direction I would really appreciate it.

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg
  • And what if you'll succeed in this?

    Would you consider that numbers '1644700809' and '1644708009' are actually the same?

    It's really dangerous. Don't even think about it.

    Vendor could have ProductionCategory included into numbers and Category 008 could mean "Phones" but Category 080 could mean "DVD players". Numbers within the Category use to be generated automatically, so you'll happily match phone to DVD player and would never realise it.

     

    _____________
    Code for TallyGenerator

  • I am only using this to display a warning to the user to give them the option of not inserting a record.

    I COMPLETELY understand that many part numbers are only off by one letter. I am really looking for a wy to minimize transposition errors. BTW, I am also comparing part names and other items to narrow the returns.

    Again, I wouldn't even think of restricting an insert on these results!

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg
  • So what's a problem?

    DIFFERENCE = 4 means "the least possible difference", see BOL.

    So, it returns you proper warning that those 2 strings are very similar as they actually are.

    _____________
    Code for TallyGenerator

  • Here's the problem...

    select difference('1644700809','5xreww332')

    select difference('1644700809','9')

    both return 4.....

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg
  • Cross posting. Topic already answered here

    http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=145&messageid=305549

     


    N 56°04'39.16"
    E 12°55'05.25"

Viewing 6 posts - 1 through 5 (of 5 total)

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