宝玉的blog

专注于web开发技术
随笔 - 81, 评论 - 1578, 引用 - 157

导航

关于


目前致力于ChinaCommunityServer的开发。

msn: junminliu(at)msn.com

标签

每月存档

最新留言

广告

 

我不废话,只发1个SQL:

select threadid from
(
select threadid, ROW_NUMBER() OVER (order by stickydate) as Pos from cs_threads
) as T
where T.Pos > 100000 and T.Pos < 100030

打印 | 张贴于 2006-01-16 17:47:00 | Tag:Web技术

留言反馈

#回复: Sql2005带来的分页便利 编辑
这样怎么样:

select Top 30 threadid from
(
select threadid, ROW_NUMBER() OVER (order by stickydate) as Pos from cs_threads
) as T
where T.Pos > 100000
2007-03-28 15:13:00 | [匿名:Sandheart]
#回复: Sql2005带来的分页便利 编辑
雨中漫步 写的方法是不错,但在MS情况SQL里好像用不了
2007-03-27 16:49:00 | [匿名:Sandheart]
#关于SQL SERVER 2005实现分页的TSQL语句。 编辑
引自 宝玉的blog : select threadid from ( select threadid, ROW_NUMBER() OVER (order by stickydate) as Pos from
2006-10-19 07:35:00 | [匿名:睡沙发的壳儿]
#关于SQL SERVER 2005实现分页的TSQL语句。 编辑
引自宝玉的blog:
select threadid from (&nbsp; select threadid, &nbsp;&nbsp;&nbsp; ROW_NUMBER() OVER (order...
2006-09-08 03:25:00 | [匿名:壳儿在沈阳搜趣堡的个人空间]
#Sql 2005 带来的分页新方法 编辑
Sql 2005 带来了许多的新函数,这些函数可以帮助我们更方便的实现分页
2006-07-02 17:10:00 | [匿名:Jresins]
#re: Sql2005带来的分页便利 编辑
好像这个便利在性能上没有带来提高,我试了一下,怎么还不如我用临时表的方式呢?
2006-06-30 10:13:00 | [匿名:qworld]
#re: Sql2005带来的分页便利 编辑
這早再DB2就有了
2006-05-21 00:45:00 | [匿名:JOHNSTIN]
#re: Sql2005带来的分页便利 编辑
好像性能不咋地 100W分页就吃了我cpu80%
2006-04-04 23:08:00 | [匿名:笨猫猫]
#re: Sql2005带来的分页便利 编辑
不如mysql limit 0,100简单.
2006-03-23 14:31:00 | [匿名:ibmwewa]
#re: Sql2005带来的分页便利 编辑
顶!
比存储过程爽多了
2006-03-13 05:38:00 | [匿名:KAI]
#re: Sql2005带来的分页便利 编辑
SQL 2005的rank和row_number和oracle的是不一样的
我一年前就在这里说过了
2006-01-23 09:29:00 | [匿名:怡红公子]
#re: Sql2005带来的分页便利 编辑
更正:然后在SQL的外面进行排序的 为 然后在SQL的外面进行分页的
2006-01-19 09:28:00 | [匿名:雨中漫步]
#re: Sql2005带来的分页便利 编辑
如果里面的这个表cs_threads数据量超大,比如,几亿条记录,那这个方法应该是有问题的

因为,select threadid from
(
select threadid, ROW_NUMBER() OVER (order by stickydate) as Pos from cs_threads
) as T
where T.Pos > 100000 and T.Pos < 100030
这个语句是把select threadid, ROW_NUMBER() OVER (order by stickydate) as Pos from cs_threads它全部取出来,然后在SQL的外面进行排序的,没在SQL2005上测试过,因为原先在ORACLE上这样的写法是不好的,ORACLE中这样写比较好:select threadid from
(
select threadid, ROW_NUMBER() OVER (order by stickydate) as Pos from cs_threads a where a.pos<100030
) as T
where T.Pos > 100000
2006-01-19 09:27:00 | [匿名:雨中漫步]
#re: Sql2005带来的分页便利 编辑
Good news.
终于看到SQLServer在海量性能处理上的架构变动了~:)
2006-01-17 18:40:00 | [匿名:minbear]
#re: Sql2005带来的分页便利 编辑
不仅支持row_number(), SQL Server 2005还支持rank(), dense_rank()
2006-01-17 12:35:00 | [匿名:walkdan]
#re: Sql2005带来的分页便利 编辑
SQL Server终于支持分页语法了...
算是好消息嗯
2006-01-17 02:54:00 | [匿名:sunmast]
#re: Sql2005带来的分页便利 编辑
it works
2006-01-17 02:02:00 | [匿名:cp]
#re: Sql2005带来的分页便利 编辑
哈哈..俺可是最先得到这语句的几个人之一哦
2006-01-16 22:39:00 | [匿名:红亭]
#re: Sql2005带来的分页便利 编辑
对MSSQL不是很熟悉,就从现在看到的不少吹捧sql server 2005的文章来看,除了可以写托管的存储过程外,楼主现在说的这个row_number olap函数以及所谓的分区数据库都是oracle 以及db2早就实现的功能。
问一下,是不是也实现了rank()等函数呢?
2006-01-16 21:41:00 | [匿名:阿]
#re: Sql2005带来的分页便利 编辑
比以前使用临时表,速度快很多倍,尤其在数据量大的情况,几十万的数据一般在200毫秒左右
2006-01-16 21:02:00 | [匿名:宝玉]
#re: Sql2005带来的分页便利 编辑
速度慢不慢啊?
2006-01-16 20:51:00 | [匿名:rIPPER]
#re: Sql2005带来的分页便利 编辑
是啊,ROW_NUMBER函数,MSDN上说要结合order by,是不是不一定需要那个?
还没仔细研究,这个特性很是有用。
2006-01-16 20:47:00 | [匿名:leonic]
#re: Sql2005带来的分页便利 编辑
什么啊???这是什么啊????????????????????
2006-01-16 20:23:00 | [匿名:sweter.chen]
#re: Sql2005带来的分页便利 编辑
什么啊???这是什么啊????????????????????
2006-01-16 20:22:00 | [匿名:sweter.chen]
对不起,目前本随笔不允许发表新评论.

Powered by: Joycode.MVC引擎 0.5.2.0