CREATE PROC [dbo].[spGetDataPaged]
@sql varchar(512),
@index int,
@line int,
@count int output
AS
BEGIN
SET NOCOUNT ON;
declare @StartRow int
declare @EndRow int
set @StartRow = (@PageIndex * @PageSize) + 1;
set @EndRow = (@PageIndex +1) * @PageSize;
SELECT * FROM
(
-- EXEC @sql; 假代码
) list
Where RowNumber >= @StartRow and RowNumber <= @EndRow;