declare @tmp int set @tmp = 0update tabele set c = @tmp,@tmp = @tmp + 1

解决方案 »

  1.   

    declare @tmp int set @tmp = 0update tabele set c = cast(@tmp as varchar(18)),@tmp = @tmp + 1
      

  2.   

    create proc p_insert_s @cnt int
     as
      declare @n int,@s varchar(16)
      set @n=1
      set @s=''
      while @n<=@cnt
       begin
        set @s=cast(@n as varchar)
        insert into table(c) select @s
        @n=@n+1
       end
    goexec('p_insert_s 50')
      

  3.   

    大力的语句:
    declare @i int 
    set @i = 0
    update table set c = @i,@i = @i + 1
      

  4.   

    declare @ int 
    set @ = 0
    update [table] set @=@+1,c=@
      

  5.   

    SELECT IDENTITY(INT,1,1) AS c,a,b INTO #aaa
    FROM tablenameDROP TABLE tablenameSELECT * INTO tablename FROM #aaa --SELECT * from tablename
      

  6.   

    declare @i int 
    set @i=0
    select @i=count(*) from yourtable where c is not null
    update table yourtable set c = @i,@i = @i + 1