• GilaMonster (9/1/2009)


    Not datepart, but try dateadd.

    p.s. the way you've written those queries is highly inefficient. By putting a function on the column, you're forcing a table scan, SQL cannot use indexes properly. Also, you can't go over the year boundries.

    Try something like this rather.

    select <Column List>

    from table1

    where

    DateCol1 between dateadd(mm, -3, getdate()) AND getdate()

    Thanks Gila, that was actually quite simple, I appreciate the insight and suggestion.