if not exists(select 1 from syscolumns where id=object_id(table1) and name='c')
begin
alter table table1
add C int
end

解决方案 »

  1.   

    if  not exists (select name from syscolumns where id=object_id('table1') and name='c')
    begin 
    alter table table1 
    add dd int 
    end
      

  2.   

    不好意思 发错啦,更正一下if  not exists (select name from syscolumns where id=object_id('table1') and name='c')
    begin 
    alter table table1 
    add c varchar(8) 
    end