sql分页

declare @currentPageIndex int
set @currentPageIndex=3
select top 5 * from (select row_number() over(order by getdate() desc) as rownumber,* from test) as temp_table
where rownumber>5*(@currentPageIndex-1)

 

创建大量数据测试

create table test
( id int identity(1,1),
data int null
)

begin tran
declare @index int set @index=0
while(@index <100000)
begin
insert into test(data) values(FLOOR(RAND(abs(checksum(newid())))*1000))
set @index=@index+1
end
commit

posted @ 2015-12-30 23:19  每天进步一点点!  阅读(264)  评论(0编辑  收藏  举报