sp_recompile

Description

Causes each stored procedure and trigger that uses the named table to be recompiled the next time it runs.

Syntax

sp_recompile objname

Parameters

objname

is the name of a table in the current database.

Examples

Example 1

Recompiles each trigger and stored procedure that uses the table titles the next time the trigger or stored procedure is run:

sp_recompile titles

Usage

Permissions

Only the Database Owner or a System Administrator can use the setuser command to assume another database user’s identity to recompile objects owned by other users. All users can execute sp_recompile to recompile their own objects.

Auditing

Values in event and extrainfo columns from the sysaudits table are:

Event

Audit option

Command or access audited

Information in extrainfo

38

exec_procedure

Execution of a procedure

  • Roles – Current active roles

  • Keywords or options – NULL

  • Previous value – NULL

  • Current value – NULL

  • Other information – All input parameters

  • Proxy information – Original login name, if set proxy in effect

See also

Commands create index, update statistics