天天看点

选择指定区间的记录

插入数据以及答案--取出sql表中第到的记录(以自动增长ID为主键)
--从数据表中取出第n条到第m条的记录*/

create table t
(
id int,
name nvarchar(20)
)

declare @id int
select @id=1

while(@id<=100)
begin
insert t 
select @id,'Name'+cast(@id as nvarchar)

set @[email protected]+1
end

select * from t

select top 10 * from 
(select top 40 * from Account where id not in 
(select top 30  id from Account )
)
 t
 
 drop table t      

转载于:https://www.cnblogs.com/mingyongcheng/archive/2011/03/15/1984985.html