I'm trying to write a Stored Procedure to return "n" number of results, from a undetermined number of rows. I intend to use it for discussionboard like view, in that you have links for "n"th page of "y" records.
e.g.
[1], 2, 3, 4, Last Page
The problem I'm having is that the table doesn't have an ordered index column (e.g. 1,2,3,4,5,6,... Instead its more like 1,2,5,9,10,43,...) so I can't do "BETWEEN X AND Y".
I've tried using a temporary table in the stored procedure, but ASP gives me an error becasue the Stored Procedure returns a closed recordset (I don't know exactly why - But I think it's because the first select statement in the Stored Procedure is an INSERT for the temporary table.)
The only other alternative is to do the processing in ASP, using GETROWS to put the entire recordset into an Array and using the array index to get the required rows. But seems such a inefficient way of doing it, as I have to return every record before I can find out which one's I want.
Anyone with any pointers?
Many thanks.
e.g.
[1], 2, 3, 4, Last Page
The problem I'm having is that the table doesn't have an ordered index column (e.g. 1,2,3,4,5,6,... Instead its more like 1,2,5,9,10,43,...) so I can't do "BETWEEN X AND Y".
I've tried using a temporary table in the stored procedure, but ASP gives me an error becasue the Stored Procedure returns a closed recordset (I don't know exactly why - But I think it's because the first select statement in the Stored Procedure is an INSERT for the temporary table.)
The only other alternative is to do the processing in ASP, using GETROWS to put the entire recordset into an Array and using the array index to get the required rows. But seems such a inefficient way of doing it, as I have to return every record before I can find out which one's I want.
Anyone with any pointers?
Many thanks.