sp_refreshview

Transact-SQL Reference

Transact-SQL Reference

sp_refreshview

Refreshes the metadata for the specified view. Persistent metadata for a view can become outdated because of changes to the underlying objects upon which the view depends.

Syntax

sp_refreshview [ @viewname = ] 'viewname'

Arguments

[@viewname =] 'viewname'

Is the name of the view. viewname, which can be a multipart identifier, is nvarchar, with no default.

Return Code Values

0 (success) or a nonzero number (failure)

Permissions

Members of the sysadmin fixed server role, the db_owner and db_ddladmin fixed database roles, and the view owner can execute sp_refreshview on a view.

Examples

This example refreshes the metadata for the view titleview.

exec sp_refreshview titleview

See Also

System Stored Procedures