if not exists(select * from syscolumns where id=object_id('xtsz') and name='icsz') begin
alter table xtsz add icsz bit
update xtsz set icsz=0
end提示字段icsz不存在,请问语句该怎么写?

解决方案 »

  1.   

    if not exists(select * from syscolumns where id=object_id('xtsz') and name='icsz') begin
    alter table xtsz add icsz bit
    end
    update xtsz set icsz=0
      

  2.   

    wxf163:能否创建的同时初始化呢
      

  3.   

    alter table xtsz add icsz bit default 0 
      

  4.   


    if not exists(select * from sysobjects where name='tver' and xtype='U') begin
    create table tver(id int identity(1,1) primary key,ver int)
    insert into tver(ver) values(0)
    end为什么这个语句就没有问题呢