你的table应当有一个key吧?
例子:table1.key1是你的key, 类型为varchar(15)
BEGIN TRANSACTION
CREATE TABLE dbo.Tmp_table1
(
ID int NOT NULL IDENTITY (1, 1),
key1 varchar(15) NULL
) ON "default"
GO
IF EXISTS(SELECT * FROM dbo.table1)
EXEC('INSERT INTO dbo.Tmp_table1(key1)
SELECT key1 FROM dbo.table1 TABLOCKX')
GO
COMMIT
然后query:='select Tmp_table1.ID,table1.* from table1,tmp_table1 where' +
' table1.key1=Tmp_table1.key1 and Tmp_table1.ID>' +
inttostr((x-1)*10) + ' and Tmp_table1.ID<=' + inttostr(x*10) +
' order by Tmp_table1.ID';