You've come to the right place!
Follow me as I show you the TSQL code that will list the tables with schema differences and show you what are the differences.
This code is especially important when you have a set of tables that must have the same schema.
Without further ado, here's the stored procedure that will search for tables that have schema differences:
The algorithm works like this:
1. Find the table names to compare the schemas
2. For each table we will identify is there is a data type in the schema of one of the tables that doesn't match.
The most important part of the code is when the table schema comparison occurs:
This code is inspired by an article at Jeff's SQL Server Blog.
I could use a parameter for the "where Table_name like" clause... but hey: this is version 1.0.0! :)
Any comments on how to improve this code are more than welcome!
Be a part of our private list!Enter your e-mail and access The Rabbit Way's exclusive offers.