If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back  dBforums > Database Server Software > Microsoft SQL Server > SQL Pagining (Find page) Help

LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Registered User
Join Date: Jan 2013
Posts: 3
SQL Pagining (Find page) Help

I have been looking for a solution to a problem for the past week and am currently pulling my hair out and hoping someone can help me. I have implemented a stored procedure in SQL Server 2008 to handle server side paging. The procedure is passed a startRowIndex and a maximum number of rows required, and then uses the ROWCOUNT to retrieve the required rows. This may not be efficient but works (any suggestions of better ways welcome).

But next when a record is added or amended in the Front end C# application I have designed, I need to find what page that record sits in, and display that page to the user, still allowing them to page ethere way from that page. Every were I have looked has focused on the Primary key, which in an ideal world would be great as you would know were in the table the record sat. But my application will allow deletes meaning there will be gaps in the sequence, plus I need the pages ordered by another column (Hence have a Clustered index on that column).

Can anyone help me, I Know it is possible as I currently use a system at work that implements this behaviorů

I would like to say thank you in advance, and please can you give examples if possible as very new to SQL.
Reply With Quote
  #2 (permalink)  
Registered User
Join Date: Nov 2003
Posts: 2,807
If this is for SQL Server, why do you post this in the ANSI SQL forum?
I will not read nor answer questions where the SQL code is messy and not formatted properly using [code] tags: http://www.dbforums.com/misc.php?do=bbcode#code

Tips for good questions:

Reply With Quote
  #3 (permalink)  
Registered User
Join Date: Jan 2013
Posts: 3
Apologies shammat first time on the forum and have had a blank moment! Is it possible to move it to the SQL server forum or is it a case of starting a new thread on that forum.
Reply With Quote
  #4 (permalink)  
Registered User
Join Date: Oct 2009
Location: 221B Baker St.
Posts: 487
Maybe our kind moderator will relocate this . . .
Reply With Quote
  #5 (permalink)  
Resident Curmudgeon
Join Date: Feb 2004
Location: In front of the computer
Posts: 14,812
Instead of waiting for a kind moderator, I jumped in and moved it... Sometimes the cranky old phart can be good for something!

Does it make sense to merge this thread with your prior thread on the same topic, or is this a "fresh start" on it?

The problem gets a bit sticky due to the underlying complexity of figuring out where your application thinks the new row ought to go in the record set it is managing. Think about the model that you're trying to implement (in terms of the document/model/view paradigm). How does that model order the document (rowset), and where does the new row being added fit within the model? Is the new row in the current view, or in a different view? If the row is in another view, does the window automagically display that new view, does it switch the model to change where the row sits (either temporarily or permanently), or does it do something different?

I know that I am asking a lot of questions, but I have to understand what you want to have any chance of giving you a correct and/or usable answer.

In theory, theory and practice are identical. In practice, theory and practice are unrelated.
Reply With Quote

sql 2008, sql paging

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On