ALTER proc [dbo].[pro_pubdatalist2]
(
@sqlappend varchar(2000),
@pageIndex int,
@pageSize int
)as
begin
declare @strsql varchar(8000)
set @strsql='SELECT top '+str(@pageSize)+'
kehu.id, kehu.khname
FROM kehu
WHERE (kehu.ID >=(SELECT MAX(id) FROM (SELECT TOP '+str((@pageIndex-1)*@pageSize+1)+' kehu.id FROM kehu
where 1=1 '+@sqlappend+'
ORDER BY id) AS T) '+@sqlappend+')'
print @strsql
exec(@strsql)
end