SQL Server Performance

getting in bettwen records from all records return

Discussion in 'SQL Server 2005 T-SQL Performance Tuning' started by sohin, Nov 29, 2006.

  1. sohin New Member

    hello

    i m getting 8K records from my query

    i want to get records in x units i.e. 500 records at a time
    first 500 rec. and then from 500 to 1000 and so on

    how can i do this using sql query
  2. jezemine New Member

    http://weblogs.sqlteam.com/jeffs/archive/2004/03/22/1085.aspx

    SqlSpec: a fast and comprehensive data dictionary generator for
    SQL Server 2000/2005, Analysis Server 2005, Access 97/2000/XP/2003
    www.elsasoft.org
  3. ranjitjain New Member

    In 2005, you can even take advantage of
    row_number() OVER(ORDER BY columnname)

    consider this example:

    WITH DynamicPages AS
    (SELECT row_number() OVER(ORDER BY column1) rownumber,column1,column2 FROM yourTable)

    SELECT column1,column2 FROM DynamicPages
    WHERE rownumber BETWEEN 500 and 1000

Share This Page