日期:2014-05-18  浏览次数:20528 次

怎么删除一个有默认值得列
alert   table1   drop   column1  
其中column1   有默认值
删除失败,应该怎么写哪

------解决方案--------------------

alert table table1 drop column column1


------解决方案--------------------
ALTER TABLE [TABLENAME] DROP COLUMN [COLUMNNAME]
------解决方案--------------------
alter table table1
drop constraint 約束名

alter table table1
drop column column1
------解决方案--------------------
alert table 表名 drop column 字段名
------解决方案--------------------
--改
alter table 表名 drop column 字段名
------解决方案--------------------
第一步:去掉默认值设置
第二步:删除列
------解决方案--------------------
在对象浏览器里找到列名 然后查看约束 如果不想用语法删可以直接右键删除默认约束
如果使用语法
使用 sp_helpconstraint 表 可以查看表约束名

alter table 表 drop constraint 约束名称
alter table 表 drop column 字段
------解决方案--------------------
接分喽~~
------解决方案--------------------
这么多分啊.
------解决方案--------------------
alter table 表名 drop constraint 约束名
alter table 表名 drop column 列名
------解决方案--------------------
这为兄弟,删除一个列之前必须检查该列上是否有约束~删除约束,再删除列。

查看一张表的约束:exec sp_helpconstraint 表名

如果有约束则先删除约束
alter table 表名 drop constraint 约束名

接着删除列
alter table 表名 drop column 列名