USE MyTestDB
--先删除约束
declare @name varchar(20)
select @name = b.name from sysobjects b join syscolumns a on
b.id = a.cdefault where a.id = object_id('UserInfo') and a.name = 'NickName'
exec('alter table UserInfo drop constraint ' + @name)

--然后再删除字段就OK了
ALTER TABLE dbo.UserInfo DROP COLUMN NickName

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-17
  • 2022-12-23
  • 2021-06-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-02
  • 2022-12-23
  • 2022-02-17
  • 2021-08-15
  • 2022-02-21
  • 2022-12-23
  • 2021-06-18
相关资源
相似解决方案