[eluser]barbazul[/eluser]
I' reading through the example page and found the following example.
I'm not an expert in MSSQL but it looks as if they are using an order by clause without any trouble.
Maybe there is a way to accomplish this after all
this is the kind of thing for which I hate working with mssql
----------------------------------------------------------
Estoy leyendo la pagina del link y encontre este ejemplo.
Ahora, yo no soy un experto en MSSQL pero parece que en el ejemplo usan un order by sin problemas
Este es el tipo de cosas por las que odio trabajar con mssql
(traduje el codigo al ingles para entendimiento general)
----------------------------------------------------------
Code:
CREATE PROCEDURE GetContactsPage
@PageSize int,
@PageNumber int
AS
DECLARE @Handle int
DECLARE @CursorType int
SET @CursorType=4 -- Forward only
DECLARE @LockType int
SET @LockType =1 -- Read only
DECLARE @Query nvarchar(4000)
SET @Query = N'SELECT ContactID, LastName, FirstName, EmailAddress, Phone
FROM Person.Contact ORDER BY LastName, ContactID'
DECLARE @rowcount int -- will always be -1
EXEC sp_cursoropen @Handle OUTPUT, @Query, @CursorType OUTPUT, @LockType OUTPUT, @rowcount OUTPUT
DECLARE @DisplacementType int
SET @DisplacementType = 32 -- Relative
DECLARE @FirstRecord int
SET @FirstRecord = @PageSize * @PageNumber + 1
EXEC sp_cursorfetch @Handle, @DisplacementType, @FirstRecord , @PageSize
EXEC sp_cursorclose @Handle