ALTER PROCEDURE [dbo].[Pro_GetSuccessPaging]
(
@PageSize int,
@CurrentPage int
)
AS
declare @a nvarchar(50)
declare @b nvarchar(50)
declare @c nvarchar(500)
declare @d nvarchar(500)
set @a=convert(nvarchar,@PageSize)
set @b=convert(nvarchar,@PageSize*(@CurrentPage-1))
set @d='select top 100 * from SuccessInfo order by SuccessDate desc'
set @c='select top '+@a+' * from ('+@d+')h where SuccessID not in (select top '+@b+' SuccessID from ('+@d+')h)'
set @c='select * from ('+@c+')m '
execute sp_executesql @c
RETURN