How to: Compare the Schemas of Two Databases

By using Team Edition for Database Professionals, you can compare the schema of two databases or of one database and one Visual Studio database project. The entities that you compare are known as the source and the target. When the schema comparison finishes, its results appear in the Schema Compare window. Also, Visual Studio generates a Data Definition Language (DDL) script that you can use to synchronize the different schemas.

After the comparison finishes, you can take other steps:

For more information about schema comparison scenarios, see Overview of Comparing Database Schemas.

To compare the schema of two databases

  1. On the Data menu, point to Schema Compare, and then click New Schema Comparison.

    The New Schema Comparison dialog box appears.

    Also, the Schema Compare window opens, and Visual Studio automatically assigns it a name such as SchemaCompare1.

  2. Specify the source and the target that you want to compare by clicking Project or Database for each.

    Note

    You can compare two databases or a database with a database project, but you cannot compare two database projects.

  3. If you clicked Database for the source or the target, connect to the data source by clicking it in the list. If no databases are listed, click New Connection to display the Connection Properties dialog box.

    In the Connection Properties dialog box, identify the server on which the source or target resides and the type of authentication to use when you connect to it. Optionally, click a database on that server. When you are finished, click OK.

    Note

    After you establish a connection, it appears in Server Explorer under Data Connections.

  4. Click OK.

    The schema comparison starts.

    Note

    You can stop a schema comparison operation that is in progress by clicking Stop on the toolbar.

See Also

Tasks

How to: Synchronize Database Schemas
How to: View Schema Differences
How to: Compare the Data of Two Databases

Concepts

Overview of Comparing Database Schemas
Terminology Overview of Team Edition for Database Professionals