A More Efficient Method for Paging Through Large Result Sets

I. SQL Server 2008 paging methods
http://stackoverflow.com/questions/4358253/sql-server-2008-paging-methods

II. SQL Server 2005 Paging – The Holy Grail
http://www.sqlservercentral.com/articles/T-SQL/66030/

III.  Paging option 

1. ROW_NUNMBER()  mới trong SQL Server 2005
http://stackoverflow.com/questions/1078956/which-paging-method-sql-server-2008-for-best-performance
http://www.4guysfromrolla.com/articles/031506-1.aspx
2. SET ROWCOUNT  (Cách nhanh nhất với dữ liệu lớn)
http://www.4guysfromrolla.com/webtech/042606-1.shtml
3. CURSORS
4. Temporary table
5. Sub query
6. other

DECLARE @maxRow int;
SET @maxRow = 100;
SET ROWCOUNT @maxRow
SELECT e.*, d.[Name] as DepartmentName
FROM @TempItems t
INNER JOIN Employees e ON
e.EmployeeID = t.EmployeeID
INNER JOIN Departments d ON
d.DepartmentID = e.DepartmentID
WHERE ID >= @startRowIndex

SET ROWCOUNT 0 (very important)

GO