今日学习心得:sqlserver2005分页查询存储过程
2011-02-14 13:25 于为源 阅读(399) 评论(0) 编辑 收藏 举报create procedure usp_ProductByCategory
(
@categoryID int,
@beginIndex int,
@endIndex int,
@docount bit
)
as
if(@docount=1)--说明只做统计计数
begin
select count(*) from ViewProduct where categoryid=@categoryid
end
else
begin
with tempbl as (select row_number() over (order by AddDate desc) as rownum,* from ViewProduct where cateoryid=@categoryId)
select * from tempbl where rownum between @beginindex and @endindex
end
本文来自博客园,作者:于为源,转载请注明原文链接:https://www.cnblogs.com/yuanyuan/archive/2011/02/14/1954262.html
如果对您有帮助,您也可以请我喝杯可乐。