Skip to content

Recompile All SQL Server Stored Procedures with this Script

Whenever updating statistics, introducing new indexes or removing old indexes, the following script offers a quick and simple way to flag any stored procedures in your tables to recompile again on next load;

-- Recompile all Stored Procedures and Triggers on a Database
USE AdventureWorks;
GO
EXEC sp_MSforeachtable @command1="EXEC sp_recompile '?'";
GO

SHARE THIS POST: