当前位置:网站首页>SQLServer的3种分页查询方式sql2000/2008/2012的
SQLServer的3种分页查询方式sql2000/2008/2012的
2022-04-21 06:38:00 【海宏AA】
判断版本,然后执行
-- select serverproperty('productversion'),serverproperty('productlevel'),serverproperty('edition'), @@VERSION
--SQL2000:8.00.194 RTM Personal Edition Microsoft SQL Server 2000 - 8.00.194 (Intel X86) Aug 6 2000 00:57:48 Copyright (c) 1988-2000 Microsoft Corporation Personal Edition on Windows NT 6.2 (Build 9200: )
--SQL2008:10.50.1600.1 RTM Enterprise Edition (64-bit) Microsoft SQL Server 2008 R2 (RTM) - 10.50.1600.1 (X64) Apr 2 2010 15:48:46 Copyright (c) Microsoft Corporation Enterprise Edition (64-bit) on Windows NT 6.2 <X64> (Build 9200: )
--SQL2012:11.0.3000.0 SP1 Enterprise Edition (64-bit) Microsoft SQL Server 2012 (SP1) - 11.0.3000.0 (X64) Oct 19 2012 13:38:57 Copyright (c) Microsoft Corporation Enterprise Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1)
-- select CONVERT(numeric(20,2), LEFT(CONVERT(varchar,serverproperty('productversion')),CHARINDEX('.',CONVERT(varchar,serverproperty('productversion')),0)))
--SQL2000
select top 20 * from ShouFeiList where 1=1 and (1<>0) and ( nID not in ( select top 15000 nID from ShouFeiList where 1<>0 order by nID)) order by nID
--SQL2008
SELECT* FROM(SELECT *, ROW_NUMBER () OVER (ORDER BY nID) AS rowNumber FROM ShouFeiList where 1<>0) as T WHERE rowNumber BETWEEN 15000 and 15020
--SQL2012
select * from ShouFeiList Order by nID Offset 15000 Row Fetch Next 20 Rows Only
版权声明
本文为[海宏AA]所创,转载请带上原文链接,感谢
https://blog.csdn.net/gssystems/article/details/120653851
边栏推荐
猜你喜欢

Implementation of crud of user management system with JDBC

论文阅读:Cached and Confused: Web Cache Deception in the wild

Information encryption and information summarization

Troubleshooting NP and OSPF

远程唤醒服务器

Set up MySQL master-slave replication, read-write separation, one master and one slave

树状数组

ETL之Kettle工具十大功能特性详解

論文閱讀:Measuring the Impact of a Successful DDoS Attack on the Customer Behaviour of Managed DNS Servi

Blue Bridge Cup - hex to octal
随机推荐
JSON编码解码
应用软件线程数与CPU核数之间的关系
2022.2.14-2.27 责任链模式
Define a standard class
.net core 部署至Linux平台上访问SQL SERVER 2008 R2时提示连接超时异常
NP、OSPF Stub區域
Sort method (2) = > insert sort
Concepts related to computer vulnerability security POC, exp, vul, CVE, 0day
Text Templates
NP, NSSA area
栈(C语言)
Leetcode 1561.你可以获得的最大硬币数目(Maximum Number of Coins You Can Get)
Sorting
c#生成中文金额并用语音读取出来的完整类
SHA256 Hashes
@Slf4j注解中 log 报错
标准函数返回值iResult
Database requirement analysis of online ordering system
db2相关操作知识点积累及WINDOWS环境DB2连接远程数据库实例
Mini examination system v1 Version 0.0