Reputation: 194
I need to compare structure of approx. 50 tables in SQL Server 2005, and write T-Sql script to make them equal. Each table has its copy in the same database, the only difference being the name and structure (e.g. original "tableName" has to be compared to "tableName_copy", and the "tableName_copy" has missing constraints, PK, FK, triggers, etc).
I know there are lots of tools on the market (both free and commercial) to compare and prepare SQL scripts, but their problem is that they can compare tables with identical names in two databases, not giving option to choose which tables compare, even less if their names differ.
I was wondering if such tools exist (it would be great if they were free or open-source) to do this job of automating script generation for chosen tables of different names. I'd appreciate if anyone who has done similar job before share his/her experience!
Upvotes: 1
Views: 582
Reputation: 4943
Could you take a different approach, copying your tablename_copy
s into a second database, but renaming them to tablename
, and then running your favorite comparison tool?
Upvotes: 1