Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2013

    Unanswered: 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.

  2. #2
    Join Date
    Nov 2003
    Provided Answers: 23
    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:

    Tips for good questions:

  3. #3
    Join Date
    Jan 2013
    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.

  4. #4
    Join Date
    Oct 2009
    221B Baker St.
    Maybe our kind moderator will relocate this . . .

  5. #5
    Join Date
    Feb 2004
    In front of the computer
    Provided Answers: 54
    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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts