if exists (select 1 from syscolumns a ,sysobjects b where b.name='表名' and a.id=b.id and b.name='列名') begin 
select '有' 
else begin 
select '没有' 
end

解决方案 »

  1.   

    if exists (select * from syscolumns a ,sysobjects b where b.name='tKHXX' and a.id=b.id and a.name='KHH') begin 
    select '有' 
    end
    else begin 
    select '没有' 
    end
      

  2.   

    if exists (select * from syscolumns a ,sysobjects b where b.name='表' and a.id=b.id and a.name='列') begin 
    select '有' 
    end
    else begin 
    select '没有' 
    end
      

  3.   

    if exists(select 1 from syscolumns where name='列名' and id=object_id('表名'))
    print '村在'
    else
    print '不存在'