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
Post a Comment