I have a datetime field called DateFinished. I need to be able to retrieve all records in which DateFinished is within the current month/year.
Just as an alternative - this should use an index on DateFinished.
SELECT * FROM MyTable WHERE DateFinished BETWEEN DATEADD(MONTH, DATEDIFF(MONTH, 0, GETDATE()), 0) AND DATEADD(MONTH, DATEDIFF(MONTH, 0, GETDATE()) + 1, 0)