SQL Server 2005 drop column with constraints

后端 未结 13 990
一向
一向 2020-12-07 23:54

I have a column with a \"DEFAULT\" constraint. I\'d like to create a script that drops that column.

The problem is that it returns this error:

Msg 50         


        
13条回答
  •  离开以前
    2020-12-08 00:35

    You can get the constraint names by querying the information_schema system views.

    select CONSTRAINT_NAME from INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE WHERE TABLE_NAME = '' AND COLUMN_NAME = 'IsClosed'
    

提交回复
热议问题