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.
Harnessing SQL Server Metadata- Disabling and Rebuilding Indexes
When doing bulk data changes it may be beneficial to disable indexes prior to starting the operation. Fortunately, SQL's rich metadata makes this very easy to automate in a robust fashion.
2018-05-18 (first published: 2015-10-19)
4,852 reads