Hi Michael,
In my case, I cannot use the TOP clause because my ORDER
BY is not by uniqueID. Instead, I have written a store
procedure. I'll post it here, maybe it will be usefull,
someday, for another user.
Thanx for you're answer,
Nicolas
- - - - - - - - - -
/*
Receive the number of the page were the user is.
This number is sent via HTTP GET or POST.
This store procedure is calle within a .asp page.
*/
CREATE Procedure sp_RechercheMembre
(
@intPage integer
)
As
DECLARE @intLoopCounter int
DECLARE @rowToFetch int
DECLARE @startingRow int
DECLARE @intAbsolute int
/*
@rowToFetch : YOU CAN CHANGE THIS VARIABLE
it is the number of row that this procedure
is going to return.
*/
SET @intLoopCounter = 0
SET @rowToFetch = 5
SET @startingRow = (@intPage - 1) * @rowToFetch
/*
Initial request.
We're going to retrieve row X to row Y
of this initial request
*/
DECLARE recherche_cursor SCROLL CURSOR FOR
SELECT NoMembre, Nom, Prenom FROM Internaute
ORDER BY Nom
OPEN recherche_cursor
SET @intAbsolute = @startingRow
WHILE @intLoopCounter < @rowToFetch
BEGIN
SET @intLoopCounter = @intLoopCounter + 1
SET @intAbsolute = @intAbsolute + 1
FETCH ABSOLUTE @intAbsolute
FROM recherche_cursor
END
Close recherche_cursor
Deallocate recherche_cursor
Return 0