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.