declare @r int select * into #t from t1 set @r=@@rowcount-20 set rowcount @r delete from #t set rowcount 0 select * from #tdrop table #t
for i:=1 to 20 begin adoquery1.last; 打印; adoquery1.prior; end;
adoquery1.last; 判断是否大于20 if adoquery1.recordcount>20 then adoquery1.move(-20)
应该是 move 还是 moveby ,查一下就可以了。
select IDENTITY(smallint,1,1) AS ii, * into #tt from tablenameselect * into #t1 from (select top 5 * from #tt order by ii desc) aa order by iialter table #t1 drop column iiselect * from #t1
select * into #t from t1
set @r=@@rowcount-20
set rowcount @r
delete from #t
set rowcount 0
select * from #tdrop table #t
adoquery1.last;
打印;
adoquery1.prior; end;
判断是否大于20
if adoquery1.recordcount>20 then
adoquery1.move(-20)