add column in a middle of a table ->refresh view | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

add column in a middle of a table ->refresh view

have addeda column to a table
in the middle of the table,when i did it and i run a view which is total independet of the new column i got wrong result!
when i open the view made a space (with the space bar) andsaved it again everything worked agin fine! (klike i made some sort of refresh!)
why is that?
how can i avoid this problem?
thnaks in advance
When you create a view (i.e. in graphics form) all table are in that view.
Then you select witch columns you want to see in the view, but all table still there.
So, when you add a new column the original table change and you have to refresh that view.
Luis Martin
Moderator One of the symptoms of an approaching nervous breakdown is the belief that one’s work is terribly important
Bertrand Russell Nunca esperes el reconocimiento de tus hijos, eso ocurrirá luego de tu muerte
All postings are provided “AS IS” with no warranties for accuracy.
That’s why sp_refreshview exists.
Btw, there really no point in adding a column in the middle of a table. It’s almost the same for the storage engine and you can customise the positions in your view anyway. —
Frank Kalis
Microsoft SQL Server MVP
Heute schon gebloggt?

but what if the changed table is contains in 20 diffrent views?
do i need then to sp_refreshview all of them?