恐怕要另写一个以某字段排列时的临时表,才能获得行的索引序列.
select flg=identity(int,1,1),col1 into #T from tb order by 索引列名
flg就是你要的.