The object 'DF__*' is dependent on column '*' - Changing int to double
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:\MSSQL\SQL2014\DATA\ChuckTest_Data.mdf', SIZE = 167872KB, MAXSIZE = UNLIMITED, FILEGROWTH = 16384KB ) LOG ON ( NAME = N'ChuckTest_Log', FILENAME = N'D:\MSSQL\SQL2014\DATA\ChuckTest_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;
作者:Chuck Lu GitHub |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
2020-04-30 git worktree 实际使用
2020-04-30 git worktree
2020-04-30 Git Worktrees: The Best Git Feature You’ve Never Heard Of
2020-04-30 Reading assembly binding log files (Fusion Log)
2019-04-30 GEEK UNINSTALLER
2015-04-30 ConcurrentDictionary<TKey, TValue>的AddOrUpdate方法