Ok its possible if you use MS sql 2005 or higher.
Let see example
with table "Mytable".Sorted by "Name" Column .
--------------------
Name
column1
column2
here is the code for stored procedure.
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
-- =============================================
-- Author: Tigran Sargsyan
-- Create date: 25.06.2009
-- Description: gets GetAddressById by Id
-- =============================================
Create PROCEDURE [dbo].[GetRowsFromCustomParts]
-- Add the parameters for the stored procedure here
@From int,
@TO int
AS
BEGIN
WITH cnx AS
(
SELECT *, ROW_NUMBER() OVER(ORDER BY Name) AS idx
FROM Mytable
)
SELECT * FROM cnx WHERE idx BETWEEN @From AND @TO
end