Deborah's Developer MindScape






         Tips and Techniques for Web and .NET developers.

August 8, 2013

SSDT Data Compare

Visual Studio 2010 had a data compare feature that was removed in Visual Studio 2012, which drew much criticism. Now its back!

If you don’t see the Data Compare option in the SQL menu of Visual Studio, see this prior post to get the update.

See this prior post for more information on SSDT.

Use the Data Compare option to compare the data in two databases.

This example compares the data in the current development database against the data in the test database.

1) SQL | Data Compare | New Data Comparison…

image

If you have used the Visual Studio 2010 data compare, you will recognize this dialog.

2) Select the Source Database

image

The current development database is selected

3) Select the Target Database

image

The current test database is selected.

4) Click Next and select the Tables and/or Views to include.

image

By default, all tables are included.

5) Click Finish.

The results appear in a tab:

image

Click any cell to view the detail in the bottom grid. For example, selecting the Customer row, Only in Source column displays the following in the bottom grid:

image

Uncheck any row that should not be updated. This gives you fine control over which data to change.

6) Click Update Target.

This updates the target database with the selected changes.

Alternatively, you can click Generate Script to create a changes script with all of the data changes.

NOTE: I have a development database with about 100 tables. When I do the data compare, two of the tables are never included in the list of tables (step #4 above). I had this same problem in the Visual Studio 2010 data compare. The two tables it skips are simple tables. I provide this note as a warning to check your results when using this feature.

Use this feature any time you need to compare data between databases, generate data scripts, or update a database with data from another database.

Enjoy!

For more information on this and other Visual Studio 2012 features, see my Pluralsight course: Mastering Visual Studio 2012.

RSS feed for comments on this post. TrackBack URI

Leave a comment

© 2019 Deborah's Developer MindScape   Provided by WPMU DEV -The WordPress Experts   Hosted by Microsoft MVPs