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

Example 1 Upgrades all compiled objects in the active database:

dbcc upgrade_object

Example 2

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

dbcc upgrade_object(listdb, 'procedure')

Example 3

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

dbcc upgrade_object(listdb, "rule")

Example 4

Example 4 Upgrades all stored procedures named list_proc in the listdb database.

dbcc upgrade_object(listdb, list_proc)

Example 5

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

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

Example 6

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

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

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.