查询结果分页显示的sql语句
来源:互联网 发布:qpst 添加端口 编辑:程序博客网 时间:2024/05/21 10:01
四种方法取表里n到m条纪录:
1.
select top m * into 临时表(或表变量) from tablename order by columnname -- 将top m笔插入
set rowcount n
select * from 表变量 order by columnname desc
2.
select top n * from
(select top m * from tablename order by columnname) a
order by columnname desc
3.如果tablename里没有其他identity列,那么:
select identity(int) id0,* into #temp from tablename
取n到m条的语句为:
select * from #temp where id0 >=n and id0 <= m
如果你在执行select identity(int) id0,* into #temp from tablename这条语句的时候报错,那是因为你的DB中间的select into/bulkcopy属性没有打开要先执行:
exec sp_dboption 你的DB名字,'select into/bulkcopy',true
4.如果表里有identity属性,那么简单:
select * from tablename where identitycol between n and m
- 查询结果分页显示的SQL语句
- 查询结果分页显示的sql语句
- sql语句查询,分批显示查询结果
- 查询结果带行号的t-sql语句,可用于sql语句分页
- C#通过SQL语句查询结果分页不用GridView的实现
- MySQL 查询in操作,查询结果按in集合顺序显示的SQL语句(笔记)
- SQL server2008 多表联合查询,分页显示结果
- 分页查询SQL语句
- sql分页查询语句
- 分页SQL查询语句
- 分页查询SQL语句
- sql查询分页语句
- SQL分页查询语句
- 分页查询SQL语句
- SQL分页查询语句
- SQL语句分页查询
- SQL分页查询语句
- SQL 分页查询语句
- 先在这里鞠躬致谢吧!
- 编程生成一个瓶子(1)
- 笑谈大先生(一)
- .net Framework 2.0 专门提供了配置文件的操作。
- 请诸位宽谅,等几天
- 查询结果分页显示的sql语句
- 笑谈大先生(二)
- 感叹一种野性文化的失去
- 性格测试 我和几个朋友测完都觉得特准-d
- 微星主板前置音频接口的连接说明
- 兼容DC
- 实用电工速算口诀
- 数字技术使智能视频监控超越传统模拟系统
- 删除表的记录以后,如何使新记录的编号仍然从1开始