如果该表有关键字段,则象下面这样写:
Select * from yourTable a
where (select count(*) from yourTable where KeyField <= a.KeyField) = 10
KeyField是你的表的关键字段的名称 yourtable是表名
如果该表没有关键字段,则想下面这样写:
Select identity(int,1,1) as id,* into #temp from yourTable
Select * from #temp where id = 10
drop table #temp
如果表没有聚集索引,或者索引在索引视图上,则行定位器就是行的聚集索引键。如果聚集索引不是唯一的索引,SQL Server 2000 将添加在内部生成的值以使重复的键唯一。用户看不到这个值,它用于使非聚集索引内的键唯一。SQL Server 通过使用聚集索引键搜索聚集索引来检索数据行,而聚集索引键存储在非聚集索引的叶行内。
由于非聚集索引将聚集索引键作为其行指针存储,因此使聚集索引键尽可能小很重要。如果表还有非聚集索引,请不要选择大的列作为聚集索引的键。
SET NOCOUNT OFF
USE pubs
IF EXISTS (SELECT name FROM sysindexes
WHERE name = 'au_id_ind')
DROP INDEX authors.au_id_ind
GO
USE pubs
CREATE INDEX au_id_ind
ON authors (au_id)
GO