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

前端 未结 9 1404
面向向阳花
面向向阳花 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
    
    0 讨论(0)
  • 2020-11-30 19:35

    Try this:

    Remove the constraint DF_Movies_Rating__48CFD27E before changing your field type.

    The constraint is typically created automatically by the DBMS (SQL Server).

    To see the constraint associated with the table, expand the table attributes in Object explorer, followed by the category Constraints as shown below:

    Tree of your table

    You must remove the constraint before changing the field type.

    0 讨论(0)
  • 2020-11-30 19:39

    Solution :

    open database table -> expand table -> expand constraints and see this

    0 讨论(0)
提交回复
热议问题