查询数据时,怎么筛选的要查多少条?
来源:互联网 发布:遗传算法 神经网络 编辑:程序博客网 时间:2024/06/10 09:50
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
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
- 查询数据时,怎么筛选的要查多少条?
- 数据库查询多少条数据
- 查询前多少条数据
- postgresql 怎么查询第一条数据
- T-SQL 查询每个表有多少条数据
- SqlServer 找出随机的多少条数据
- mysql 查询大于多少天的数据
- Oracle查询前多少条记录的方法
- 几千万条数据,怎么让查询效率高起来?
- 数据库-使用查询到的不同字段的两条SQL的结果进行筛选查询
- 查询任意多少条记录到多少条记录
- mysql查询筛选出多列值同时重复的数据
- 筛选多条记录中的连续数据
- 查询大于10条的数据
- oracle查询某条数据的行号
- 查询重复的多条数据
- sql 查询第几条到第几条的数据
- 如何查询前30条数据的后5条
- jsp基本语法介绍
- 同一个数据库将一个表的数据复制到另一个表!
- Identity 2.0
- PHPWind回应被阿里妈妈收购传闻:只是合作
- 很炫的伸缩效果,我喜欢!HOHO
- 查询数据时,怎么筛选的要查多少条?
- 浅谈jvm-Java虚拟机( Virtual Machine)
- 【aspx.net】DataList绑定DataSet后如何让每一行产生一个行号
- 关于IE7.8.弹出窗口顶上
- SPING框架部署在websphere上碰到的问题
- SOA杂谈:挫折、挑战和发展前景
- NFTL_AML_fixbug_flagMcompare
- ext 多文件上传控件 Ext.ux.UploadDialog 使用中的问题
- 动态网页制作技术JSP与ASP的比较