Using dbcc upgrade_object

Syntax

dbcc upgrade_object [ ( dbid | dbname 
[, ['database.[owner].]compiled_object_name' | 
 'check' | 'default' | 'procedure' | 'rule' | 
 'trigger' | 'view' 
 [, 'force' ] ] ) ]

where:

NoteIf set quoted identifiers is on, use single quotes around the keywords. If set quoted identifiers is off, you can use either double quotes or single quotes.

Examples

Example 1

dbcc upgrade_object

Upgrades all compiled objects in the active database.

Example 2

dbcc upgrade_object(listdb, 'procedure')

Upgrades all stored procedures in the listdb database. Single quotes are used around procedure because set quoted identifiers is on.

Example 3

dbcc upgrade_object(listdb, "rule")

Upgrades all rules and check constraints in the listdb database. Double quotes are used around rule because set quoted identifiers is off.

Example 4

dbcc upgrade_object(listdb, list_proc)

Upgrades all stored procedures named list_proc in the listdb database.

Example 5

dbcc upgrade_object(listdb, 
  "listdb.jkarrik.list_proc")

Upgrades the stored procedure list_proc, which is owned by the login “jkarrik”.

Example 6

dbcc upgrade_object(master, 
  "listdb.jkarrik.list_proc")

Returns an error because the value of dbname is master and the value of database is listdb. These values must match.

Permissions

Only the database owner or a system administrator can execute dbcc upgrade_object. The database owner can upgrade his or her own objects in the database.

Upgraded objects retain the same owner that they had prior to being upgraded.