1.
select (select count(*) from a where code<=t.code) code,Name from a t

解决方案 »

  1.   

    1.
    create table b (code int identity(1,1) NOT NULL
    ,name char(2))
    select name into b(name) from a
      

  2.   


    update b set name_b=name_a
    from a,b
    where a.no1=b.no2
      

  3.   

    2.
    uptate b set name_b=a.name_a from a where b.no2=a.no1
      

  4.   

    --2.update 表 set col=substring(replace(','+col+',',',1,',',2,'),2,len(replace(','+col+',',',1,',',2,'))-2)
    where charindex(',1,',','+col+',')>0
      

  5.   

    3.
    update t set col=substring(replace(','+col+',',',1,',',2,'),2,len(col))
      

  6.   

    ','+col+','
    为什么要加上两个“,”号?
    update 表 set col=substring(replace(col,',1',',2'),1,len(replace(col,',1',',2')))
    where charindex(',1',col)>0
    这样不行吗?
    再就是还有,第一个问题
    如果用   a1n1(阿贵) 的方法:
    create table b (code int identity(1,1) NOT NULL
    ,name char(2))
    select name into b(name) from a
    执行后,会提示:
    'name' 附近有语法错误。
    所以说,是不是应该不能这样写?
    如何写呢?
    请出手吧。。
      

  7.   

    第二个已经解决了,第三个我没有测试,但是看了这个sql语句之后,应该说是可以的。
    谢谢邹老大!
    接分,
      

  8.   

    select a.name into b(name) from