So i have a very strange issue, If i run a query like this:
SELECT *
FROM tbl_x
WHERE tbl_x.SomeCode IN ('1','2','3','4','5','6')
The query uses the index on the table, however if i do query this:
SELECT *
FROM tbl_x
WHERE tbl_x.SomeCode IN ('1','2','3','4','5','6','7')
The query ignores the index and decides to do a Table Scan
Why is MS SQL Server not using the index when there are more than 6 values in the Where clause?