How to: Preview Refactoring Changes

This topic explains how to preview the changes before you rename a database schema object. You can preview the changes before you rename an object to verify the changes that will be made to the following:

  • Schema objects

  • Script files

  • Data generation plans

  • Unit tests

When you rename a schema object, other objects that reference the renamed object are automatically updated with the new name. For example, if you rename a column in a table, any stored procedures that reference that column are automatically updated with the new name. For more information, see Refactor Database Code and Data.

You preview changes by selecting the Preview changes check box in the Rename dialog box. You can still cancel the rename operation when you are previewing the changes.

To preview changes before you make them

  1. In the Rename dialog box, type the new name of the object.

  2. Select the Preview changes check box, and click OK.

    The Preview Changes dialog box appears and contains an upper pane and a lower pane. The upper pane contains a tree that lists the objects that will be changed, and the lower pane shows the script that will be generated to make the changes. The upper pane displays the old name, and the lower pane displays the new name.

  3. In the upper pane, expand Schema Objects.

    A .sql node for the schema object that you are renaming (or the object that contains it) appears, along with .sql nodes for any schema objects that reference the renamed object.

  4. Click any one of the .sql nodes.

    The lower pane displays the Transact-SQL code with the new name highlighted.

  5. Click Apply.

    The changes are made. The object name is updated, and the new name appears in Schema View.


    You can undo the changes. For more information, see How to: Undo a Database Refactoring Operation.

Community Additions