Thursday, 30 May 2013

FORCESEEK HINT is extended in Denali

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

Online Index Rebuild in Denali

The previous versions of SQL Server never allowed index operations (CREATE, DROP, REBUILD) on ONLINE mode, if the index includes a Large Value Type column (VARCHAR(MAX), NVARCHAR(MAX), VARBINARY(MAX) etc).

This limitation has been removed in SQL Server 2012 (Denali). The above code runs without an error in a SQL Server 2012 instance.