IF NOT EXISTS ( SELECT name FROM sysobjects WHERE id = ( SELECT syscolumns.cdefault FROM sysobjects INNER JOIN syscolumns ON sysobjects.Id=syscolumns.Id WHERE sysobjects.name=N'tableName' AND syscolumns.name=N'columnName' ) )BEGIN ALTER TABLE tableName add constraint DF_columnName DEFAULT N'N' for columnName; PRINT N'New add DF_columnName';ENDELSEBEGIN PRINT N'DEFAULT FOR columnName HAD EXISTS';END
新闻热点
疑难解答