:: Home  >  Matthias Denkmaier
User: Guest  Login
Matthias Denkmaier
C# - what else?
Blog search:  
How To: Resolving unexpected behavior and errors using SQL Server views

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!


Share this post: Email it!
Posted:  10/14/2007 9:34:00 AM  by  mdenkmaier
Tags:  SQLHow to
Comments are not allowed on this item!