好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

sql分页查询几种写法

关于SQL语句分页,网上也有很多,我贴一部分过来,并且总结自己已知的分页到下面,方便日后查阅

1.创建测试环境 ,(插入100万条数据大概耗时5分钟)。

create database DBTest
use DBTest
 
--创建测试表
create table pagetest
(
id int identity(1,1) not null,
col01 int null,
col02 nvarchar(50) null,
col03 datetime null
)
 
--1万记录集
declare @i int
set @i=0
while(@i<10000)
begin
 insert into pagetest select cast(floor(rand()*10000) as int),left(newid(),10),getdate()
 set @i=@i+1
end 

查看更多关于sql分页查询几种写法的详细内容...

  阅读:51次