if not exists(select 1 from syscolumns a inner join sysobjects b on a.id=b.id where b.type='U' and b.name='info' and a.name='khName' alter table info add khName nvarchar(50)
create table info(id int) go if not exists(select 1 from syscolumns a inner join sysobjects b on a.id=b.id where b.type='U' and b.name='info' and a.name='khName') alter table info add khName nvarchar(50) go select * from info /* id khName ----------- --------------------------------------------------(0 行受影响)*/ go drop table info
alter table info add khName nvarchar(50)
go
if not exists(select 1 from syscolumns a inner join sysobjects b on a.id=b.id where b.type='U' and b.name='info' and a.name='khName')
alter table info add khName nvarchar(50)
go
select * from info
/*
id khName
----------- --------------------------------------------------(0 行受影响)*/
go
drop table info