在SQL数据库中,判断指定表中是否存在指定列,如果不存在,则创建:
if (NOT exists ( select * from dbo.syscolumns where name = 'g_id_gglx' and id in
(select id from dbo.sysobjects where id = object_id(N'[dbo].[crm_custom_zk]') and OBJECTPROPERTY(id, N'IsUserTable') = 1))
)
Alter table crm_custom_zk add g_id_gglx varchar(50) not null DEFAULT ''"