I have table dbo.Items
:
[id] [bigint] [not null]
[Name] [nvarchar](200)
[Decription] [nvarchar](500)
Also about 15 views
with using table Items
, e.g: ASM_V_ItemOrders
so now, I'm going to change length:
alter table Items
alter column Description nvarchar(1000) null
But, i get a lot of errors from views:
Msg 5074, Level 16, State 1, Line 22 The object 'ASM_V_ItemOrders' is dependent on column 'Description'.
How to solve these problem via sql query?
CodePudding user response:
If you use indexed views then you will need to drop the view first. And recreate the view after the alter table.
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.
source: CREATE VIEW (Transact-SQL)