Playing with Visual Studio 2010, I discovered that Ultimate (and Premium) editions come with a utility for comparing data and SQL schemas, and decided to check it out.
I made two databases, SourceDB and TargetDB with a single Customer table. Here is the data in the tables.
Master
Next, I selected Compare Data for the source table in Server Explorer
In the dialog that appeared, I chose the final database and clicked Next - I decided to leave all the options checked.
The following dialog showed the tables and views that I would like to compare - in my case, only Customer.
Result
Now the fun part
Modified entries are, of course, highlighted.
In addition to the records that should be updated, note that there is one record in the source table, which must be added to the final table and one completely identical, which should remain unchanged. Let's look at them.
')
Update
But on this we have not finished. Of course, I can update the final database directly from VS, for this I have two ways - to generate a script or allow VS2010 to update the data for me. Because I'm just playing with the possibilities anyway, I think it's worth seeing both options. To begin, choose
This will give us a generated Sql script, which can be used to update the database of course. It looks like this:
If you look deeper ... mm ... VS disables FK constraints, performs all operations - and includes back, great.
Because I'm a little lazy, I want Visual Studio to do all the work for me - and all that needs to be done ... right-click and select ...
VS2010 will show a confirmation dialog, I know what I'm doing, so just click OK and the changes will be published to the final database.