When SQL Server chooses seek over scan while retrieving record details, it
will compare key value with search input, based on comparison result, Query
engine will move to appropriate page. If index has multiple columns, if we
don't want all key columns to consider, in SQL Server 2012, we can mention the
index columns to consider when the index has multiple key columns.
SELECT EmployeeID,EmployeeName,Account
FROM
Employees
WITH
(FORCESEEK(Idx_Employee(EmployeeID)))
WHERE
EmployeeID = 1024
No comments:
Post a Comment