id 是标识列吗 select id from yourtable A where (select count(1) from yourtable where id <= A.id) = 1000
select top 1500 id=identity(int,1,1) into # from syscolumns--删除一些记录 delete from # where id between 158 and 287 or id in (1,2,5)--select * from #select * from ( select id,排名=(select count(*) + 1 from # where id<A.ID) from # A )B where 排名 =1000drop table #
你的麻烦 SELECT TOP 页大小 * FROM TestTable WHERE (ID > (SELECT MAX(id) FROM (SELECT TOP 页大小*页数 id FROM 表 ORDER BY id) AS T)) ORDER BY ID
select top 1 * from tablename where id not in (select top 999 id from tablename);
select id from yourtable A where (select count(1) from yourtable where id <= A.id) = 1000
delete from # where id between 158 and 287 or id in (1,2,5)--select * from #select * from
(
select id,排名=(select count(*) + 1 from # where id<A.ID)
from # A
)B
where 排名 =1000drop table #
SELECT TOP 页大小 *
FROM TestTable
WHERE (ID >
(SELECT MAX(id)
FROM (SELECT TOP 页大小*页数 id
FROM 表
ORDER BY id) AS T))
ORDER BY ID