• BrainDonor (6/9/2009)


    If a selection is required on the date part of a datetime field what would be the best way of doing it?

    BETWEEN's often very useful

    Another method I have used is using DATEDIFF to check the number of days difference, but does this suffer the same kind of penalty?

    Any form of function on a column will prevent index seeks on that column. That includes all SQL functions, all forms or arithmetic, string concatenation, etc. If you apply any change to a column in the where/join then it's no longer eligible for index seeks.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass