Search

Tuesday, April 5, 2011

System Stored Procedure sp_recompile

Whenever you add new indexes to a table or modify its structure extensively is a good practice to recompile all stored procedures involved with that table, so the queries included on those stored procedures could be reoptimized.

The following example is using the Employees table of AdventureWorks database.

USE AdventureWorks;
GO
EXEC sp_recompile N'HumanResources.Employee';
GO

Resulting message for this instruction should be:
Object 'HumanResources.Employee' was successfully marked for recompilation.

No comments:

Post a Comment