Causes stored procedures and triggers to be recompiled the next time they are run.
sp_recompile [@objname =] 'object'
0 (success) or a nonzero number (failure)
None
sp_recompile looks for an object in the current database only.
The queries used by stored procedures and triggers are optimized only when they are compiled. As indexes or other changes that affect statistics are made to the database, compiled stored procedures and triggers may lose efficiency. By recompiling stored procedures and triggers that act on a table, you can reoptimize the queries.
Note Microsoft® SQL Server™ automatically recompiles stored procedures and triggers when it is advantageous to do so.
Execute permissions default to the public role. Users that are not members of the sysadmin fixed server role or the db_owner fixed database role can affect only their own tables.
This example causes the triggers and stored procedures that uses the titles table to be recompiled the next time they are run.
EXEC sp_recompile titles