简体   繁体   中英

Ways to compare sql database schema programmaticall in C# .net or .netcore

There exists a way to compare two SQL databases and generate the change scripts and even deploy the changes to the remote database. I have seen somewhere in one of the blogs where the author describe the way to programmatically iterate all the objects of the database and allow you to control the comparison. I am quite unable to find that link but if anyone knows the snippet of the code or the nugget packages to begin with please post here.

Go to

Tools --> Sql Server --> New Data Comparison | New Schema Comparison

You will use the same libraries like for deploying a dacpac project: DacServices utility class in Microsoft.SqlServer.Dac .

You will use 'Extract' method to create a dacpac files for your source database and then use 'Deploy' or 'GenerateDeployScript'.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM