VB.net SQL Views don't incorporate new columns added to a table
Hi
I have a number of Views in my SQL 2014 database that pull data from a number of tables. If I add new columns to one of the tables then run my application that reads the database schema to show all columns from the table doesn't update. Is this because the schema in the database hasn't been updated?
Is there a way to refresh all views so that they bring in new columns?
In this case use below to get the newly added columns..
EXECUTE sp_refreshview N'ViewName';
Vitor Montalvão
sp_refreshview does NOT add new columns. As it says in the MSDN article it only refreshes the metadata for the view (column data type change or relationships changes for example).
Pawan Kumar
I mean if the user added new columns in the table and if you have "SELECT *" in the view then one has to
use below to get the new column from the view.
EXECUTE sp_refreshview N'ViewName';