Visual Studio2017 Database Schema comparison

Source: Internet
Author: User

First, preface

Development time on the test server and the network server has our database, when we modify or add some fields on the online network, the database of the network needs to be updated, this time according to the table modification records, and then the online network above one to increase the modification is wasteful and error-prone, Is there a better way to solve the problem? Yes! That's the architecture comparison feature that comes with vs.

Individuals feel that in the early stages of development, in addition to mastering the necessary development knowledge, the use of development tools and understanding of the level is also critical. Just want to know the extent of the API, skilled use lets you develop the heart of the hand.

Ii. about

Starting with the version of Visual Studio 2005, VS has started to support the "compare and Synchronize Database Schemas", which Microsoft has done so long ago. This is a feature we will often use. This feature can be implemented by ourselves (by comparing views, stored procedures, and table structures in SQL Server), or packaged as a tool (self-developed MSSQL architecture and data comparison gadget). For beginners a little bit of trouble, here is not to say, interested can see.

Iii. start of the walkthrough

This walkthrough uses VS2017 's own SQL Server tools to compare the schemas of two databases and synchronize the schema and source schemas of the target.

1. Prepare two databases to compare

I have two databases, one local and one test server. This walkthrough will connect me to these two databases.

2. Connecting the source and destination databases

The so-called source and target databases are literally meaning (Source > target) to synchronize the new modifications in the source data to the target database.

First we open the Vs> tool >sql server> new schema comparison.

Select source

We select the database, click Select Connection

Connect to the source server and verify that you don't forget to select the database

Select target action and select source

Connect to the target server and verify that you don't forget to select the database

3. Comparing the source and target databases

When both the source and target databases are selected, click Compare in the top left corner to start comparing two databases

Here are the differences between the source and target databases

4. Update the target database

When the comparison is complete, select the update in the upper-left corner to update the field data we select to update (the field in the red tag circled in the figure)

The synchronization of data is actually the difference between generating the corresponding script and then executing it in the target database. Select View results to see the deployment script

See the tip We know the update is complete. Then we'll do a "comparison" to see the difference.

This time we will find that the synchronization has been synchronized, if you want to all sync, all tick is, architecture comparison is so simple, this walkthrough is here.

Visual Studio2017 Database Schema comparison

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.