difference between using between and >= and <=

  • elaine-131617

    Ten Centuries

    Points: 1066

    Does anyone know if there is a difference in performance using between in your where clause vs >= and <=. For example:

    select column from table where recdate between '2/1/09' and '2/10/09'

    vs

    select column from table where recdate >= '2/1/09' and recdate <= '2/10/09'

    We tested both and they returned a result set in the same amount of time and the query plan looked the same.

    Thanks

    Elaine

  • GSquared

    SSC Guru

    Points: 260824

    SQL Server translates "between" into the other at runtime. No difference except possibly readability.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • elaine-131617

    Ten Centuries

    Points: 1066

    Thank you!

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

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