Sometimes you have to create views which are based on other views or tables.
But there are some limitations and pitfalls when it comes to making changes in the structure of the underlying tables/views:
- If a view depends on a table or view that was dropped, the Database Engine produces an error message when anyone tries to use the view.
- If a new table or view is created and the table structure does not change from the previous base table to replace the one dropped, the view again becomes usable.
- If the new table or view structure changes, the view must be dropped and re-created
- Instead of dropping and recreating the view you can also run sp_refreshview specifying the view name
Syntax for sp_refreshview:
sp_refreshview ’[your_viewname]’
Hope this helps!