--建表
create table table1(id int identity(1,1) primary key,name varchar(20))
declare @i int
set @i=1
while @i<80
begin
insert into table1 select 'a'+cast(@i as varchar)
set @i=@i+1
end
--删除几条,造成不连续:
delete from table1 where id in (2,12,22,32)
第31-40行应该是从 35到44
--2005的写法:
select id,name from (select row_number() over(order by id asc ) as nid,* from table1) as a
where nid between 31 and 40
/*
---------------------------------------
35 a35
36 a36
37 a37
38 a38
39 a39
40 a40
41 a41
42 a42
43 a43
44 a44
*/
2000的写法,其它人补充吧.