Skip navigation

When I change a table definition it often invalidates any views on that table. How can I fix this without re-creating the view?

A. Just like sp_recompile works for stored-procedures there is a way (with 7.0 and above anyway) to do this for views :-

sp_refreshview <viewname>

It is trivial to write a cursor round sysobjects and then run this automatically via EXEC (..) to refresh all views in a database.


TAGS: SQL
Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish