Identifying the same table (after a rename ) in different databases.

  • Good morning,

    A while back I started working on some inhouse software for the company I work for to script the differences between our database and itself after a set amount of time. This was fairly easy and worked well. We have a system which allows us to send updates to our clients and update their files / database to support new aditions to our software.

    This model works fine assuming that all clients are running an identical copy of our database at some point in time.

    The problem comes in trying to get all databases to be identical. I changed my scripts to compare different databases but found that if a table has been renamed the system has no data that it can compare together to say that two tables are the same table and it has been renamed.

    The sql I am using to get the list of tables for our database is

    select [name] as table_name, id as [object_id] from sysobjects where type = 'U'

    The id is used to compare tables, but to run it cross database these are different for each table. Is there any way to find the same table in different databases given the name and/or columns may not be the same?

    Thanks,

    Scott MacLeman 

  • This may or may not help, have you looked into SQL Compare and SQL Data Compare.

    http://www.red-gate.com/products/SQL_Compare/index.htm

    http://www.red-gate.com/products/SQL_Data_Compare/index.htm

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply