Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
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: 1757 | Views in the last 30 days: 5
 
Related Articles
FORUM

Metadata issue in SSIS package

Issue encoutnered in SSIS package due to Metadata change

FORUM

change collation field

change collation field

FORUM

Which Stored Procedure changed

Which Stored Procedure changed

FORUM

Metadata Structure / Design Issues

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

FORUM

Stored Procedure Metadata

Query which columns returned by a stored procedure

 
Contribute