Compare records of each tables of Source & Target database

Dear Friends,
In last post we have seen how easy to find the database changes and generate script for the changes that will help you in deployment.

Similarly sometimes you need to know

row by row data difference in two databases

so don’t worry about that because visual studio 2010 provided

data comparison

option also. Just follow below steps and you are good to go for database changes also
Step 1:-

Go to following menu in Visual Studio as shown in below Fig
Data ==> Data Compare ==> New Data Comparison

dataCompareOption
Step 2:- When you click the above provided menu then you will get following screen. Just configure the

source and Destination databases

.
Check record comparison options which you want like different records only, only in source, only in destination, identity records etc. Now press NEXT button.

DataComparision

Step 3:- As you press the next button you will find the screen where you can select all or particular table or view for comparison as shown in below fig.

Datacomparison_Table_Selection

Step 4:- Once you have selected the particular table(s) and view (s) you will get following screen where you can find table wise comparison like, How many identical records in both tables ?, How many records exists only in source table?, How many records exists only in destination table ?

And below the comparison grid you will find different tabs also for different result sets you just need to select the tab to see the records associated with those particular criteria.

DataComparision_ResultSet

Step 5:- Now with show data update script menu option you can generate script.

Database_Comparison_Result_Set

script_After_Data_Comparison

Now just copy & paste and you are good to go.
So I hope you understand the essence of this utility also.

Enjoy .NET
Enjoy learning.
Keep Sharing 🙂

Your host
Rajat Jaiswal

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s