初识 存储过程

 

 

--仅仅是test

create proc JustForTest
@pageIndex int,
@pageSize int,
@count int output
as
begin
 select @count=COUNT(1) from Users with(nolock)
 
 select * from
 (
 select *,ROW_NUMBER() over(order by Id desc) as rowIndex from Users with(nolock)
 ) as a
 where a.rowIndex between (@pageIndex-1)*@pageSize and @pageIndex*@pageSize
end



--调用

declare @count2 int
exec JustForTest 2,2,@count2 output
print @count2

 

posted on 2018-01-06 22:51  奔游浪子  阅读(56)  评论(0)    收藏  举报

导航