手机
当前位置:查字典教程网 >编程开发 >mssql数据库 >SQL2005 高效分页sql语句
SQL2005 高效分页sql语句
摘要:1、复制代码代码如下:selecttop10*from(selecttop(@Page*10)ROW_NUMBER()OVER(orderb...

1、

复制代码 代码如下:

select top 10 * from

( select top (@Page * 10) ROW_NUMBER() OVER (order by id) as RowNum, id, username

from Guest where username = 'user'

) as T

where RowNum > ((@Page - 1) * 10)

2、

复制代码 代码如下:

select * from

( select ROW_NUMBER() OVER(order by id) as RowNum,id,username

from Guest where username = 'user'

) as T

where RowNum between 31 and 60

3、

复制代码 代码如下:

with T as

(select ROW_NUMBER() OVER(order by id) as RowNum,,id,username

from Guest where username = 'user'

)

select * from T

where RowNum between 31 and 60

【SQL2005 高效分页sql语句】相关文章:

SQLServre中的控制流语句

SQL Server 2008 密钥 key 使用方法

SQL2005 服务器因重装改名后出错的说明

高效的SQLSERVER分页查询

MSSQL 2005 安全设置图文教程

SQL Server2005下的安全操作技巧分享

SQL Server 清空删除日志

SQL Server 2008 R2数据库镜像部署图文教程

SQLServer2005 Output子句获取刚插入的ID值

玩转-SQL2005数据库行列转换

精品推荐
分类导航