select top 1 a.* from (select top 1000 * from 表 order by 排序字段) a order by a.排序字段 desc

解决方案 »

  1.   

    alter table 表名 add 列名 int identity primary key
    select * from 表名 where 列名=1000
    然后删除新加的列
      

  2.   

    select indetity(1,1) as newID ,a.* into #t from 表 aselect * from #t where newID = [n] -- 你所期望的记录号
      

  3.   


    select identity(bigint,1,1) as Newid ,  * into #tmp from testselect * from #tmp where NewID=1000 --修改这里可以查你想要的第N条纪录,这样会多出NewID列,如果有需要,你可以把*替换成明确的列名
      

  4.   

    to :libin_ftsafe(子陌红尘) 
      select indetity(1,1) as newID ,ArrearageList.* into #t from 表 ArrearageList  select * from #t where newID = [1000]  drop table #t
    ---------------------------------
    服务器: 消息 195,级别 15,状态 10,行 1
    'indetity' 不是可以识别的 函数名。
      

  5.   

    to:NinGoo(宁哥)
     select identity(bigint,1,1) as Newid ,  * into #tmp from ArrearageList select * from #tmp where NewID=1000 drop table #tmp-----------------------------------------
    服务器: 消息 8108,级别 16,状态 1,行 6
    无法使用 SELECT INTO 语句向表 '#tmp' 中添加标识列,该表中已有继承了标识属性的列 'ID'。
    ---------------
    我的表中原先就有主键
      

  6.   

    to:NinGoo(宁哥)
      如果没有主键,读取第10W条就耗时:0:00:17
      那要是读第100W条呢?
      

  7.   

    select identity(bigint,1,1) as newID ,ArrearageList.* into #t from 表 ArrearageListselect * from #t where newID = 1000
      

  8.   

    -------------------------------------------------
    to:NinGoo(宁哥)
      如果没有主键,读取第10W条就耗时:0:00:17
      那要是读第100W条呢?
    -------------------------------------------------那就对临时表建主键
      

  9.   

    to  libin_ftsafe(子陌红尘) 
     记录很多的话怎么办?
     关键是我查的不是第1000条,而是100W条