sql server - how to update syscolumns of a view after alter table - T-SQL? -


this question has answer here:

today noticed when alter table in view, syscolumns of view not updated without run sp_refreshview. code bellow show i'm talking about

create table test ( n1 decimal(12,4) ) go create view vtest select * test; go sp_help vtest go alter table test alter column n1 decimal(12,2) go sp_help vtest 

note vtest stay static, there someway automate process ?

you need call sp_refreshview update view

create table test ( n1 decimal(12,4) ) go create view vtest select * test; go sp_help vtest go alter table test alter column n1 decimal(12,2) exec sp_refreshview  vtest go sp_help vtest 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -