if exists(select * from syscolumns where id=object_id('TA') and name='ZDA')
   alter table TA drop column ZDA;alter table TA add ZDA int not null default 0;

解决方案 »

  1.   

    if exists(select * from syscolumns where object_id=object_id('TA') and name='ZDA')
       alter table TA drop column ZDA;alter table TA add ZDA int not null default 0;
      

  2.   

    --借用一下SQL codeif exists(select * from syscolumns where id=object_id('TA') and name='ZDA')
       alter table TA drop column ZDAalter table TA add ZDA int not null default 0 with values -- 多了with values而且,直接赋值
      

  3.   

    if exists(select * from syscolumns where id=object_id('TA') and name='ZDA')
       alter table TA drop column ZDA;alter table TA add ZDA int not null default 0;
      

  4.   


    if exists(select * from syscolumns where id = object_id('TA') and name='ZDA')
    beginalter table TA add ZDA int not null default 0
    end