if exists( select name from syscolumns where id=object_id('tn') and name='id')
begin 
 alter table tn drop column id
end--tn为表名

解决方案 »

  1.   

    if exists( select name from syscolumns where id=object_id('score') and name='id')
    begin 
     alter table score drop column id
    end
      

  2.   

    if exists(select * from syscolumns where id=object_id(N'score') and name=N'id')
      alter table score drop column id
      

  3.   

    if exists(select * from syscolumns where id=object_id(N'score') and name=N'id')
      alter table score drop column id
      

  4.   

    if exists (select column_name from table  )
    begin 
    alter table drop column column_name
    end