Sql_Server中如何判断表中某列是否存在
时间:2014-05-07 07:33:47
收藏:0
阅读:373
/*判断表AA中是否存在AA_ID这一列,如果不存在,则新增*/ IF NOT EXISTS (SELECT 1 FROM syscolumns INNER JOIN sysobjects ON sysobjects.id = syscolumns.id WHERE syscolumns.name = ‘AA_ID‘ AND sysobjects.name = ‘AA‘) ALTER TABLE AA ADD AA_ID VARCHAR(30) NULL GO
评论(0)