HiveBrain v1.2.0
Get Started
← Back to all entries
snippetsqlMajor

How can I compare the schema of two databases?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
canthedatabasestwohowcompareschema

Problem

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?

Solution

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.

Context

StackExchange Database Administrators Q#95236, answer score: 24

Revisions (0)

No revisions yet.