A coworker recently introduced me to the SQL Server Schema Compare extension in Azure Data Studio. It has come in handy since we don’t have any paid-for tools, so it has been a great help to have this extension installed. I will show you how I used it in this blog post. Please visit this Microsoft link for more details on the extension and its primary usage.
Installing the Extension
You will need to install the extension before comparing databases. To do this, you: 1) navigate to Extensions, 2) search for compare, and 3) click Install. You are ready to compare.
Connecting Via Azure
You may use the Servers area of Connections to store your server connections. However, I really like using the Azure area in Connections to connect to my Azure SQL dbs. Expand Azure near the bottom of the window. You can also use the Servers list to do what I will show in the Azure list – comparing database schemas.
You may not need to authenticate in the Linked accounts panel if you’ve used it recently. It will take you to the web to authenticate; then, you can return to Azure Data Studio.
At that point, you should see a listing of your Azure account with subscriptions and all kinds of data-related objects you can access. Make sure to connect to all the SQL databases you want to compare before comparing. Otherwise, the compare won’t see them or compare them. To connect, click the plug icon.
Comparing Databases
Right-click on a database you want to compare and choose Schema Compare.
It will populate the database information on the left. You will need to select your target.
Sometimes it will change the connections in the dialog box, so confirm your source and target.
Clicking OK will bring you back to the main compare screen. You need to click Compare to begin the comparison.
It may take a while for the comparison to complete depending on how many objects it has to compare.
It may find nothing.
But let me make some differences to see the comparison in action. After adding a table to one of them, I have these results now. You can see a table in the target that is not in the source.
Making Changes Based on the Comparison
You can apply the changes or generate a script for the changes.
There is much to like about it, especially since it’s free. I used Redgate SQL Compare in the past. In terms of its functionality, their product is more dynamic and adjustable, but if you are looking for a free solution, you won’t go wrong with this schema compare extension.
The post Azure Data Studio Schema Compare Extension appeared first on sqlkitty.