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

  • nilknarf1972

    Valued Member

    Points: 64

    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: 3969

    You are comparing strings, not numbers.




    --Vadim R.

  • MVDBA (Mike Vessey)


    Points: 21757

    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


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

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