天天看點

選擇指定區間的記錄

插入資料以及答案--取出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