--1.“俄罗斯存储过程”的改良版 CREATEprocedure pagination1 (@pagesizeint, --页面大小,如每页存储20条记录 @pageindexint--当前页码) asset nocount on begin declare@indextabletable(id intidentity(1,1),nid int) --定义表变量 declare@PageLowerBoundint--定义此页的底码 declare@PageUpperBoundint--定义此页的顶码 set@PageLowerBound=(@pageindex-1)*@pagesize set@PageUpperBound=@PageLowerBound+@pagesize setrowcount@PageUpperBound insertinto@indextable(nid) select gid from TGongwen where fariqi >dateadd(day,-365,getdate()) orderby fariqi desc select O.gid,O.mid,O.title,O.fadanwei,O.fariqi from TGongwen O,@indextable t where O.gid=t.nid and t.id>@PageLowerBoundand t.id<=@PageUpperBoundorderby t.id end set nocount off 缺点:必须有主键。