How to: View Schema Differences

You can determine how a source schema differs from a target schema by comparing them and viewing the results as a tree in the Schema Compare window. For example, you can show only those objects that exist in the source but not in the target. You can also view details about how particular objects differ, and you can refresh the results to reflect recent changes. For more information about how to perform these types of comparisons, see How to: Compare Database Schemas.

You can also view the results as Transact-SQL (T-SQL) commands in a script that would synchronize the target with the source. You can display this script in the Schema Update Script window or the T-SQL editor, and you can also export the script to a file. If you decide to update the target to match the source, you can immediately run the script to synchronize the schemas, or you can modify the script and then run it. For more information, see How to: Synchronize Database or Server Objects.

To filter the results by type

  1. On the Schema Compare toolbar, click Filter.

  2. Click one or more options to specify which sets of results you want to display.

    Note

    By default, all results will appear if you refresh the results or perform another comparison.

To view changes within an object definition

  • Click any row in the grid where the status is New, Missing, or Different by Shape.

To refresh comparison results

  • On the Schema Compare toolbar, click Refresh.

    The source and target are compared again, and the results of the comparison are updated.

To view the synchronization script

  • On the Data menu, point to Schema Compare, and click Show Schema Update Script.

    The Schema Update Script window appears and shows the script that you can use to update the target to match the source.

To open the synchronization script in the T-SQL editor

  • On the Data menu, point to Schema Compare, point to Export to, and click Editor.

    The T-SQL editor appears and shows the script that you can use to update the target to match the source.

To save the synchronization script to a file

  1. On the Data menu, point to Schema Compare, point to Export to, and click File.

    The Save Update Schema Script dialog box appears.

  2. In Object name, type the name that you want to give the synchronization script, and click Save.

    The script is saved to the file name that you specified.

See Also

Concepts

Terminology Overview of Database Edition

Compare and Synchronize Database Schemas

Other Resources

Scenario: Compare and Synchronize the Database Project with Changes to a Database