Introduction
When you're working on your Dev Database, an urgent issue comes
along, and you instantly solve it by changing Scheme in the Staging Database or
Production Database :3, few more these type of patching and you're completely
out of sync!
A lot of paid alternatives are there like SQL Data Compare by RedGate, but my first choice is Visual Studio's SQL Data Tools. In the following article, I tried to image-describe the steps for SQL Data Tool.
Like I said before, there are lots of handly DBAtools out there to compare Schema between two DB Sources. I would like to discuss how you can compare two SQL Server DB with Visual Studio.
Make sure you have SQL Server Data tools checked while installing Visual Studio.
Comapre Scema
Then, Select Source and Destination Database Source with Catalog name
After Selecting the Source and Database, click on "Compare"
Then the comparison begins and you wait for it to complete. The bigger the DB with respect to Schema, the more time it takes.
After the comparison is complete, you can see the changed items and added items.
Click on the items you want to move to Source to Destination :D
Click Shift + Alt + G to generate Scripts to update Schema from Source to Destination
The generated scripts will be open in a separate window
You can Run from Visual Studio Or copy-paste the Script and Run in your destination db SSMS.
If you run from SSMS, make sure SQLCMD in enabled.
Conclusion
In today's article, we have seen how we can easily compare schema across different server hosted same Database. Visual Studio's build in SQL Schema comparison is a free tool for this compared to other paid alternatives.
Comments
Post a Comment