How to rename SQL Server objects

Last modified: October 1, 2024

The Rename functionality provides an easy way to change an object name for a new one that better reveals its purpose and automatically finds and corrects all references to it.

You can rename an object only in a script, and not in a database.

The Rename refactoring is available for:

  • Tables
  • Temporary tables and columns
  • Views
  • Stored procedures
  • Functions

To rename an object in the SQL editor:

  1. Right-click the required object, point to Refactoring and select the Rename command from the shortcut menu. Alternatively, press F2. The object will be highlighted.

List of keywords not sorted by relevance

  1. Type a new name for the object in the SQL editor window.
    As you type, a ToolTip appears instructing to Press F2 to preview changes or Enter/Tab to apply.

  2. Press F2 to open the Preview Changes - Rename dialog window and preview code changes, to apply changes press the Apply button;

  3. Alternatively, press Enter/Tab to apply changes in the code.

Download dbForge Studio for SQL Server and try it absolutely free for 30 days!