SQL Clone
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)

Recompile All Databases stored Procedures

By Mark Huber,

this iteration of the steps will recompile( or more correctly mark for recompilation ) all stored procedures in all the databases.

You could easliy add an AND and and further filtering to only work with just the objects you are needing to recompile.

I have had a few issues where I renamed and database and the execution plans were pointing to the old database and it was trying to use and offline database. So I created this. Once I ran this there were no more issues and all the procs execution plans were fresh.

Thanks for looking. 

Total article views: 689 | Views in the last 30 days: 5
 
Related Articles
ARTICLE

The RECOMPILE Options

This artcle attempts to differentiate between the uses of WITH RECOMPILE and OPTION (RECOMPILE) feat...

ARTICLE

Optimizing Stored Procedures To Avoid Recompiles

One of the most overlooked areas in optimizing SQL Server and Transact-SQL is the recompilations of ...

FORUM

Query Execution Plans & Recompilation

Do IF-THEN statements cause recompilation?

FORUM

Reindexing requires recompile of Stored procedures

After reindexing a database application fails, recompile of Sp correct problem.

SCRIPT

Rebuild or recompile all views

Simple script to refresh or recompile your business-level views.

Tags
database    
recompile    
stored procedures    
 
Contribute