Performing Refactoring of Database Objects

Renaming database objects using refactoring implies making changes in all dependencies. This way all relations, foreign keys, and references will be kept. This topic gives description of performing renaming procedure of a database object using refactoring.

Renaming Objects from Database Explorer

Basic refactoring process

1. Select the object you want to rename in the Database Explorer tree and right-click it.

2. On the shortcut menu, point to Refactoring, and then click Rename.

3. In the Rename dialog box, enter the new name of the object and click OK.

4. In the Preview Changes window, view the changes that will be applied to your database. Clear the check boxes near the ones that you do not need.

5. Click Apply.

-or-

1. Double-click an object you want to rename.

2. Change the name and press ENTER.

3. In the message box, click Refactor.

4. In the appeared Preview Changes window, view the changes that will be applied to your database. Clear the check boxes near the ones that you do not need.

  1. Click Apply.

Using refactoring script

You can view changes that will be made to the database before applying them. For this, you can:

  1. Check the Generate script without updating database option.
  2. Click Apply.
  3. The generated script will be opened in the SQL Editor.
  4. View the script and press F5 to execute it and apply changes to the database.

Renaming Database Objects from Object Editors

To rename an object with refactoring from object editor, you should:

  1. Open the object editor.
  2. Rename the object.

Note

You can also rename columns using refactoring in the table editor.

  1. Click the Update Database or Script Changes button.
  2. In the appeared message, click Yes.
  3. View changes in the Preview Changes window, adjust them, if needed.
  4. Click Apply or Generate (depends on what you are doing - updating a database right away or viewing script changes).

Multiple refactoring in table editor

You can rename several columns at once using refactoring. To do this:

  1. Open the table you want to edit in the table editor.
  2. Rename the columns you need to rename.
  3. Click the Update Database or Script Changes button.
  4. View changes in the Preview Changes window. Changes in the tree are grouped by columns.
  5. Click Apply or Generate (depends on what you are doing - updating a database right away or viewing script changes).