How can do sql server schema compare of two databases?

419    Asked by Ankesh Kumar in SQL Server , Asked on Apr 23, 2021

Is there a way to find the differences in two SQL Server databases (schema only). One is local and the second is at a customer's site. We are experiencing problems with crystal reports running some reports and some code not executing and it would appear that the schemas don't match. Can I run the same command on both databases and compare the results to tell where the differences are? How does sql server schema compare?

 

Answered by Charles Parr

If you cannot use one of the many tools out there because of connectivity problems and want an "offline" compare, you can use SSMS to generate scripts for all database objects by right clicking on the database and using the "Tasks/Generate Scripts" function, and make sure you select to create one file per object. When you have done that for both databases, get the two sets of scripts onto a local machine in two separate folders and use WinMerge (or similar) to compare the two.

You can use SQL Server Data Tools  (SSDT), an extension of Visual Studio. You can extract your database schema as a .dacpac file and compare that with another .dacpac file or an existing database. SSDT is included with SQL Server 2012 client tools, making it pretty accessible. You can find the full instructions of how to run the compare on the MSDN site.




Your Answer

Interviews

Parent Categories