Sql server 2005带来的分页便利
发布日期:2021-06-30 19:07:56 浏览次数:2 分类:技术文章

本文共 701 字,大约阅读时间需要 2 分钟。

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

===========================================

如果里面的这个表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 

 

转载地址:https://linuxstyle.blog.csdn.net/article/details/1536940 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:修改SQL SERVER内置存储过程
下一篇:SQLserver安全设置攻略

发表评论

最新留言

网站不错 人气很旺了 加油
[***.192.178.218]2024年04月07日 20时46分33秒