sql分页demo

ALTER proc [dbo].[ProcGetUserInfoPageInfoByUserName]
@UserName varchar(200),
@PageIndex int,
@PageSize int
as
Begin
select Row_Number()over(order by UserID)as RowNumber, UserID, UserName,
Mobile, WeixinID, Unit, IsReturnReceipt,'' as RegionMap,IsPSUser,UserCode
into #Main
from dbo.UserInfo
where UserName like '%'+@UserName+'%' and Status=0 select UserID, UserName, Mobile, WeixinID, Unit, IsReturnReceipt, RegionMap,IsPSUser,UserCode ,(select count(1) as TotalCount from #Main) as TotalCount
from #Main
where RowNumber between (@PageIndex-1)*@PageSize+1 and @PageIndex*@PageSize End sql语句
  select * from (
  select *,(select count(*) from t_approval_baseinfo) as TotalCount,Row_Number()over(order by reciev_time desc) as RowNumber
  from t_approval_baseinfo) rds
  where rds.RowNumber between (1-1)*10 +1 and 1*10
上一篇:WampServer的下载方法


下一篇:java8 Stream的实现原理 (从零开始实现一个stream流)