assume your table has a primary key or datetime field, create a stored procedurecreate proc Get1000Records
@Key varchar(100) = null
as
if @key is null
Select top 1000 * from yourtable order by YourKeyField
else
select top 1000 * from yourtable where YourKeyField > @Key order by YourKeyField
if you need to go backward/forward, then you need to remember the last key and first keyalso seehttp://www.4guysfromrolla.com/webtech/062899-1.shtmlhttp://www.15seconds.com/issue/010308.htmhttp://www.aspfree.com/print/1417,0/
@Key varchar(100) = null
as
if @key is null
Select top 1000 * from yourtable order by YourKeyField
else
select top 1000 * from yourtable where YourKeyField > @Key order by YourKeyField
if you need to go backward/forward, then you need to remember the last key and first keyalso seehttp://www.4guysfromrolla.com/webtech/062899-1.shtmlhttp://www.15seconds.com/issue/010308.htmhttp://www.aspfree.com/print/1417,0/
select top 1000 * from table where id not in (select top 1000 id from table)
select top 1000 * from table where id not in (select top 1000 id from table order by id) order by id
你每次附的文章都很好,对我们帮助很大,国外不知道有哪些网站可以找到更多的优秀的资料啊?
交流--查询第X页,每页Y条记录
邹建
@lastProductID int,
@pageSize int
AS
SET ROWCOUNT @pageSize
SELECT *
FROM Products
WHERE [standard search criteria]
AND ProductID > @lastProductID
ORDER BY [Criteria that leaves ProductID monotonically increasing]
GO