Sql分页,Sql2000/2005适用

create table #tempOrders --创建临时表
(
row smallint not null IDENTITY(1,1),
CustomerID nchar(5) null,
EmployeeID int null,
ShipCity nvarchar(15) null
)

--填充临时表
insert into #tempOrders(CustomerID,EmployeeID,ShipCity) select CustomerID,EmployeeID,ShipCity From Orders

--获取分页数据
select * from #tempOrders where row>=5 and row<=10

 

Marked

你可能感兴趣的:(sql,table,null,insert)