首页 > 代码库 > sql分页demo
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
sql分页demo
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。