假如你的表有主键ID,并且按ID来排序.select * from tb a left join (你搜的记录集) b on a.id=b.id+1 where b.任何一个字段 is not null
create proc pr_inc @base_num int, @incr_num int --@base_num为查找的n,@incr_num 为n以外要查找的n as select top (@base_num+@incr_num) * from table -- where table_id not in (select top @base_num table_id from table ) --table 为你的源表,table_id为你源表的唯一标示符 go--输入数值,查询结果 exec pr_inc @base_num,@incr_num
create proc pr_inc @base_num int, @incr_num int --@base_num为查找的n,@incr_num 为n以外要查找的n as select top (@base_num+@incr_num) * from table -- where table_id not in (select top @base_num table_id from table ) --table 为你的源表,table_id为你源表的唯一标示符 go--输入数值,查询结果 exec pr_inc @base_num,@incr_num
@base_num int,
@incr_num int
--@base_num为查找的n,@incr_num 为n以外要查找的n
as
select top (@base_num+@incr_num) * from table --
where table_id not in (select top @base_num table_id from table )
--table 为你的源表,table_id为你源表的唯一标示符
go--输入数值,查询结果
exec pr_inc @base_num,@incr_num
@base_num int,
@incr_num int
--@base_num为查找的n,@incr_num 为n以外要查找的n
as
select top (@base_num+@incr_num) * from table --
where table_id not in (select top @base_num table_id from table )
--table 为你的源表,table_id为你源表的唯一标示符
go--输入数值,查询结果
exec pr_inc @base_num,@incr_num