To assist the testing in database migration or database changes, I have built a script that does the following:
- Pass in the connection of the 2 databases that you want to compare
- For each database, list out all the tables in alphabetical order
- For each table, print out the number of columns and the number of rows
- Print out the tables that exist in Database A but not not Database B and vice versa
- For tables that exist in both databases, compare the number of columns, number of rows, and database schema (e.g.: varchar or nvarchar)
- If database schema is different, print out the schema in both databases