The object 'DF__*' is dependent on column '*' - Changing int to double

前端 未结 9 1445
面向向阳花
面向向阳花 2020-11-30 19:07

Basically I got a table in my EF database with the following properties:

public int Id { get; set; }
public string Title { get; set; }
public string Descript         


        
9条回答
  •  被撕碎了的回忆
    2020-11-30 19:34

    When we try to drop a column which is depended upon then we see this kind of error:

    The object 'DF__*' is dependent on column ''.

    drop the constraint which is dependent on that column with:

    ALTER TABLE TableName DROP CONSTRAINT dependent_constraint;
    

    Example:

    Msg 5074, Level 16, State 1, Line 1

    The object 'DF__Employees__Colf__1273C1CD' is dependent on column 'Colf'.

    Msg 4922, Level 16, State 9, Line 1

    ALTER TABLE DROP COLUMN Colf failed because one or more objects access this column.

    Drop Constraint(DF__Employees__Colf__1273C1CD):

    ALTER TABLE Employees DROP CONSTRAINT DF__Employees__Colf__1273C1CD;
    

    Then you can Drop Column:

    Alter Table TableName Drop column ColumnName
    

提交回复
热议问题