Why is SQL Server not using Index for very similar datetime query?
问题 i have a table on SQL Server with about 1 million rows. It has an ID (PK), a status (int) and a datetime column. Also I've created an Index on the datetime column. Now I've found out an effect, which I don't understand. SELECT status FROM table WHERE dateTime BETWEEN '2010-01-01T00:00:00' AND '2010-01-02T12:00:00' This statement returns 3664 rows. It runs about 150ms and the execution plan shows that its doing an index seek with key lookup. Now, if I change it as following (just change the