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

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

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.

Changing the size of a column referenced by a schema-bound view in SQL Server

The object 'Address_e' is dependent on column 'Addr1'.
ALTER TABLE ALTER COLUMN Addr1 failed because one or more objects access 
this column.

The views are probably created using the WITH SCHEMABINDING option and this means they are explicitly wired up to prevent such changes. Looks like the schemabinding worked and prevented you from breaking those views, lucky day, heh? Contact your database administrator and ask him to do the change, after it asserts the impact on the database.

From MSDN:

SCHEMABINDING

Binds the view to the schema of the underlying table or tables. When SCHEMABINDING is specified, the base table or tables cannot be modified in a way that would affect the view definition. The view definition itself must first be modified or dropped to remove dependencies on the table that is to be modified.

CREATE VIEW (Transact-SQL)

SCHEMABINDING
Binds the view to the schema of the underlying table or tables. When SCHEMABINDING is specified, the base table or tables cannot be modified in a way that would affect the view definition. The view definition itself must first be modified or dropped to remove dependencies on the table that is to be modified. When you use SCHEMABINDING, the select_statement must include the two-part names (schema.object) of tables, views, or user-defined functions that are referenced. All referenced objects must be in the same database.

Views or tables that participate in a view created with the SCHEMABINDING clause cannot be dropped unless that view is dropped or changed so that it no longer has schema binding. Otherwise, the Database Engine raises an error. Also, executing ALTER TABLE statements on tables that participate in views that have schema binding fail when these statements affect the view definition.

USE master;
IF NOT EXISTS (SELECT * FROM sys.databases WHERE name = 'ChuckTest')
    CREATE DATABASE ChuckTest
    ON PRIMARY
           (
               NAME = N'ChuckTest_Data',
               FILENAME = N'D:MSSQLSQL2014DATAChuckTest_Data.mdf',
               SIZE = 167872KB,
               MAXSIZE = UNLIMITED,
               FILEGROWTH = 16384KB
           )
    LOG ON
        (
            NAME = N'ChuckTest_Log',
            FILENAME = N'D:MSSQLSQL2014DATAChuckTest_Log.ldf',
            SIZE = 2048KB,
            MAXSIZE = 2048GB,
            FILEGROWTH = 16384KB
        );
GO

USE ChuckTest;
IF (NOT EXISTS
(
    SELECT *
    FROM INFORMATION_SCHEMA.TABLES
    WHERE TABLE_SCHEMA = 'TheSchema'
          AND TABLE_NAME = 'Student'
)
   )
    CREATE TABLE Student
    (
        Id INT,
        FirstName NVARCHAR(20),
        LastName NVARCHAR(20)
    );
IF (NOT EXISTS
(
    SELECT *
    FROM INFORMATION_SCHEMA.TABLES
    WHERE TABLE_SCHEMA = 'TheSchema'
          AND TABLE_NAME = 'Score'
)
   )
    CREATE TABLE Score
    (
        StudentId INT,
        Score INT
    );

GO

CREATE VIEW V_StudentScore
WITH SCHEMABINDING
AS
SELECT a.Id,
       a.FirstName,
       a.LastName,
       b.StudentId,
       b.Score
FROM dbo.Student AS a
    INNER JOIN dbo.Score AS b
        ON a.Id = b.StudentId;
GO

DROP VIEW dbo.V_StudentScore
ALTER TABLE Score ALTER COLUMN Score int;
原文地址:https://www.cnblogs.com/chucklu/p/14721377.html