CSDN博客

img lanbaibai

分页空间的存储过程

发表于2004/7/9 10:46:00  563人阅读

CREATE procedure pr_Get_Expert
(@pagesize int,
@pageindex int,
@docount bit)
as
set nocount on
if(@docount=1)
select count(F_ID) from t_Expert
else
begin
declare @indextable table(id int identity(1,1),nid int)
declare @PageLowerBound int
declare @PageUpperBound int
set @PageLowerBound=(@pageindex-1)*@pagesize
set @PageUpperBound=@PageLowerBound+@pagesize
set rowcount @PageUpperBound
insert into @indextable(nid) select F_ID from t_Expert order by F_ID desc
select O.* from t_Expert O,@indextable t where O.F_ID=t.nid
and t.id>@PageLowerBound and t.id<=@PageUpperBound order by t.id
end
set nocount off
GO
0 0

相关博文

我的热门文章

img
取 消
img