如果表中存在唯一索引列(如id): select * from t where id not in(select top 20 id from t)如果表中不存在唯一索引列: select identity(int,1,1) as tid,* into #t from t delete #t where id <= 20 alter table #t drop tid select * from #t
select identity(int,1,1) as id ,* into # from 表select * from # where id>20
select * from t where id not in(select top 20 id from t)如果表中不存在唯一索引列:
select identity(int,1,1) as tid,* into #t from t
delete #t where id <= 20
alter table #t drop tid
select * from #t