ms sql中没有
临时表,加个id字段
select id=identity(int,1,1),* into temp from tb
select * from temp where id>=3 and id<=7
drop table temp
临时表,加个id字段
select id=identity(int,1,1),* into temp from tb
select * from temp where id>=3 and id<=7
drop table temp
调试欢乐多
SELECT TOP m-n+1 *
FROM tablename
WHERE (id NOT IN
(SELECT TOP n-1 id
FROM tablename))
(@strSQL nvarchar(4000),
@recStart int=1, --这里的m
@recEnd int=999999)--这里的n(n>=m)
As
begin
set nocount on
declare @p1 int
declare @recCount int
set @recCount=@recEnd-@recStart+1
exec sp_cursorOpen @p1 output, @strSQL
exec sp_cursorFetch @p1,16,@recStart ,@recCount
exec sp_cursorClose @p1
end
use master
getRangeRecs 'select * from sysobjects',1000,2000即从1000行开始取出(2000-1000+1)条记录