select id=identity(int,1,1) , * into test from tbselect zd1 + cast(id as varchar) from test

解决方案 »

  1.   

    declare @t table(CODE varchar(8))
    insert into @t select 'C'
    insert into @t select 'C'
    insert into @t select 'C'
    insert into @t select 'C'
    insert into @t select 'C'
    insert into @t select 'C'
    insert into @t select 'C'
    insert into @t select 'C'declare @i int
    set @i=0update @t set @i=@i+1,CODE=CODE+rtrim(@i)select * from @t/*
    CODE     
    -------- 
    C1
    C2
    C3
    C4
    C5
    C6
    C7
    C8
    */
      

  2.   

    exec sp_msforeachtable 'DBCC CHECKTABLE(''?'',REPAIR_REBUILD)'    --修复表
    exec sp_msforeachtable 'DBCC DBREINDEX(''?'')'                    --重建索引