• It probably actually needs to be:

    where (finalcalledpartynumber = ('386') OR callingPartyNumber = ('386'))

    AND dateTimeOrigination >= @StartInt

    AND dateTimeOrigination<= @EndInt

    Without the parentheses around the party numbers, it won't use the second half of the Where clause correctly.

    - 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