Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

pagination query for MSSQL Expand / Collapse
Author
Message
Posted Friday, April 06, 2007 11:40 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Saturday, April 07, 2007 10:06 AM
Points: 6, Visits: 1
hi i need to know the pagination query for MS sql , we got a table with more than i million records and when we any query it returns thousands of results, i need to do pagination so that i can break the results into pages.

i am using php and querying ms sql table.

thanx very much!
Post #356593
Posted Friday, April 06, 2007 12:29 PM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Friday, January 31, 2014 7:46 AM
Points: 1,599, Visits: 134

If you are using sql server 2005 you can achieve this by using the row number function and then using the row number to return a subset of the data based on its row number.

Here's a couple of artcles which give examples of how to do this

http://www.davidhayden.com/blog/dave/archive/2005/12/30/2652.aspx

http://www.sqlteam.com/item.asp?ItemID=26455

http://aspnet.4guysfromrolla.com/articles/031506-1.aspx

 

hth

 

David

Post #356607
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse