最好不要用临时表之类的,就在sql语句中做

解决方案 »

  1.   

    alter table test add id int identity(1,1) not null
      

  2.   

    The IDENTITY function can only be used when the SELECT statement has an INTO clause.
    So,your question is very difficult。
      

  3.   

    如果姓名唯一:Select [id]=(select count(1) from userlist where name<=t.name),
           name,
           sex,
           tel,
           city 
    from userlist t
    order by name
      

  4.   


    同意楼上的说法:select (select count(*) from shop_jb where a.name1<=name1) id,
     name,sex,city from userlist a  order  by id
      

  5.   


    同意楼上的说法:select (select count(*) from shop_jb where a.name<=name) id,
     name,sex,city from userlist a  order  by id
      

  6.   

    vivianfdlpw() ( ) 信誉:100
    你的思路很强o
    不过好像会出现问题
    正常:123
    不正常:
           122(遇到同名时候)
           132(name没有排序时)
      

  7.   

    不好意思,没看清楚..........
    1.如果姓名唯一:
    2.order by name
    这两个没看到
      

  8.   

    alter table test add id int identity(1,1) not null