SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


pagination query for MSSQL


pagination query for MSSQL

Author
Message
Ramandeep Singh-420625
Ramandeep Singh-420625
Grasshopper
Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)

Group: General Forum Members
Points: 18 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!
David Scotland-132255
David Scotland-132255
SSCrazy
SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)

Group: General Forum Members
Points: 2235 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


Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search