Find Only Yesterday's Orders?

  • Date range queries should always be in the form of:

    Where MyDate >= StartofRange and MyDate < EndOfRange

    Using a function call against a datetime column uses more resources because it has to be applied to all rows and it prevents use of indexes.

    You might argue that your table is small and it doesn’t make much difference, but there is no reason to use a worse method when a better one is available. The arguments in favor of coding this type of query with a function call amount to saying “in some cases, it isn’t much worse that the better method”. Not much of an argument.

Viewing post 16 (of 15 total)

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