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
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
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:
You must remove the constraint before changing the field type.
open database table -> expand table -> expand constraints and see this