sql里有返回当前记录是第几行的函数或是关键字吗?例如像oracle里的rownum这样的功能

解决方案 »

  1.   

    没有。
    一般可以通过临时表建立一个identity字段,然后可以根据这个来判断。
      

  2.   

    好像没有哦,写sql语句就行了
      

  3.   

    sql2005用row_number,例如用ID区分大小.select * from
    (
    select * , px = row_number() over(order by id) from tb
    ) t
    where px = ...--sql 2000,用子查询
    select * from
    (
    select * , px = (select count(1) from tb where id < t.id) + 1 from tb t
    ) t
    where px = ...