I compared a SQL Server 2005 paging query using ROW_NUMBER() with the SQL 2000 way of paging through temp or derived tables, both run on AdventureWorks.
STUFF Boundaries: Insert Text and Handle NULL Results
STUFF boundaries govern insertion and deletion. See valid positions, zero length, NULL replacement and out-of-range starts.
SQL SERVER – Index Seek Vs. Index Scan (Table Scan)
Index Scan retrieves all the rows from the table. Index Seek retrieves selective rows from the table.
SQL SERVER – Difference between DISTINCT and GROUP BY – Distinct vs Group By
What is the difference between DISTINCT and GROUP BY? They usually produce the same plan. Use GROUP BY for aggregates and DISTINCT to remove duplicates.







