Random number in results searching IDNUMBER >= '1000205830' and IDNUMBER

  • nilknarf1972

    SSC Rookie

    Points: 32

    IDNUMBER >= '1000205830' and IDNUMBER <= '1000206010' ORDER BY ID_NUM DESC

    I'm also getting IDNUMBER 1000206 included in my results?

  • rVadim

    Hall of Fame

    Points: 3937

    You are comparing strings, not numbers.

    '1000205830'

    '1000206'

    '1000206010'

    --Vadim R.

  • MVDBA (Mike Vessey)

    SSC-Insane

    Points: 21197

    rvadim is correct

    just take the single quotes out of the query. - however if you have stored this as varchar (which is madness) thenyou need to use convert or cast on those values... but even better is to make sure it's an int and get rid of the quotes

    MVDBA

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

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