@RecordsInPerPage --每页的记录数
@PageNo           --当前页号

如下示例,正确替换@RecordsInPerPage和@PageNo就可方便的取得对应页的记录,效率很好

select  TOP @RecordsInPerPage from Employee
and EmpID not in
   (select TOP @RecordsInPerPage*(@PageNo-1)  EmpID
      where
         DepId='45'
      order by EmpID
    )
order by EmpID

posted on 2007-03-29 19:14  gjung  阅读(590)  评论(0编辑  收藏  举报