Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Refreshing Views and Recompiling Stored Procs

By Jano Petras,

When a table is modified by changing the order of fields or changing field type or adjusting field sizes etc, some of the dependent views (or views on views on views :)) may become invalid as they store some metadata in order to run more efficiently. These views would need to be refreshed with new metadata. Stored procedures store their execution plans as metadata as well, and it is a good idea to recompile them if the underlying tables have changed. This script goes through all views/stored procedures and markes them for recompilation or refreshes them. Use SQL Query analyser or SQL Server management studio to run it against a SQL Server 2000/2005 database. It will also notify you of any potential errors within the views.

Total article views: 1754 | Views in the last 30 days: 10
Related Articles

Metadata issue in SSIS package

Issue encoutnered in SSIS package due to Metadata change


change collation field

change collation field


Which Stored Procedure changed

Which Stored Procedure changed


Metadata Structure / Design Issues

Implementing a way to store metadata aginst items in an application.


Stored Procedure Metadata

Query which columns returned by a stored procedure


Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones