------------------创建表 CREATE TABLE TEST (ID int PRIMARY KEY IDENTITY(1,1),--自增主键 [Name] varchar(50) NOT NULL, --名称 Remark varchar(50) NOT NULL, --随机函数 Date datetime --日期 ) ---------------生成数据 declare @i int declare @Name varchar(50) set @i=1 while @i<1000000 begin set @Name ='NA'+right('00000'+cast(@i as nvarchar),6) insert into TEST([Name],Remark,Date) values(@Name,newid(),GETDATE()) set @i=@i+1; end; -------------------查询分页 select top 10 * from Test where ID>( select max(ID) from ( select top 900000 ID from TEST order by ID ) as t ) order by ID