Export (0) Print
Expand All

Rename Views

You can rename a view in SQL Server 2012 by using SQL Server Management Studio or Transact-SQL.

Caution note Caution

If you rename a view, code and applications that depend on the view may fail. These include other views, queries, stored procedures, user-defined functions, and client applications. Note that these failures will cascade.

In This Topic

Prerequisites

Obtain a list of all dependencies on the view. Any objects, scripts or applications that reference the view must be modified to reflect the new name of the view. For more information, see Get Information About a View. We recommend that you drop the view and recreate it with a new name instead of renaming the view. By recreating the view, you update the dependency information for the objects that are referenced in the view.

Security

Permissions

Requires ALTER permission on SCHEMA or CONTROL permission on OBJECT is required, and CREATE VIEW permission in the database.

Arrow icon used with Back to Top link [Top]

To rename a view

  1. In Object Explorer, expand the database that contains the view you wish to rename and then expand the View folder.

  2. Right-click the view you wish to rename and select Rename.

  3. Enter the view’s new name.

Arrow icon used with Back to Top link [Top]

To rename a view

While you can use sp_rename to change the name of the view, we recommend that you delete the existing view and then re-create it with the new name.

For more information, see CREATE VIEW (Transact-SQL) and DROP VIEW (Transact-SQL).

Arrow icon used with Back to Top link [Top]

Ensure that all objects, scripts, and applications that reference the view’s old name now use the new name.

Arrow icon used with Back to Top link [Top]

Community Additions

ADD
Show:
© 2014 Microsoft