How to compare two SQL Server databases?

oipij1gg  于 2023-10-15  发布在  SQL Server
关注(0)|答案(1)|浏览(146)

I have two SQL Server databases on different servers.

We deploy my code to two servers, but sometimes we forget my changes in SQL Server (I don't use migration because my source code is old).

Now, how can I know the difference between the two databases in the structure? For example, which table was added? Which column is added in which table?

gj3fmq9x

gj3fmq9x1#

There are several tools available:

  • Visual Studio has SQL Server Data Tools (SSDT). Which has Schema Compare. It is quite good. I have used it for many years. You can see the differences and either apply the changes or generate a script to synchronize the database. It has tons of options, for instance you can choose which things you want to ignore from the comparison (for instance you can ignore comments).
  • Although I haven't used it, Red Gate had also tools to compare and synchronize both data and schema.

相关问题