How can I prevent a record from appearing based on two columns

  • crmitchell - Wednesday, February 1, 2017 2:54 AM

    DesNorton - Wednesday, February 1, 2017 2:45 AM

    However ....
    When comparing varchars
    '100' < '99'

    That's because '1' < '9' in all collations I am aware of - you will also find that '099' < '100'

    Agreed.
    The comparison is always reliable, but the OP needs to be certain that he is not trying to do a numeric comparison of a varchar field

  • drew.allen - Tuesday, January 31, 2017 9:39 AM

    bgalway - Tuesday, January 31, 2017 7:13 AM

    can you really use < on varchar data and have it act reliably? Or do you have to convert it into a number?

    Yes, you can use it reliably.  The point was to be able to pick one of the two records.  It doesn't matter which of the two you pick, as long as you only pick one of them.  It doesn't matter that a different method (converting to numeric) might sometimes pick the other of the two records as long as either method will only pick one of them.  It doesn't matter that changing the collation may change the results, it still only picks one of them.

    Drew

    DesNorton - Wednesday, February 1, 2017 2:45 AM

    However ....
    When comparing varchars
    '100' < '99'

    It's still reliable.  '100' will always be less than '99'.  And as I also said, "a different method(converting to numeric) might sometimes pick the other of the two records."  Just because it doesn't give the answer that you expect, doesn't mean that it's not reliable.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

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

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