SQLDMO Compare DB help needed please

G

Guest

I am trying to compare the tables in two similar databases using the SQLDMO
object. I am able to use this object to access different SQL servers and
choose two different databases. The versions of the databases are slightly
different so I would like to be able to compare them for things like
datatypes, primary and foreign keys, number of records etc. I know that
there are packages out there that do this kind of thing but I have to
complete this task myself in house. Would anyone have any code doing this
kind of thing or could anyone point me in the direction of help in terms of
which specific objects I should be using to complete the task I have set??
Thanks for any help you can give me
 
N

Nicholas Paldino [.NET/C# MVP]

Stephen,

You could use SQLDMO for this, but you might have a much easier time
issuing statements against each db and comparing the structures that way.
Basically, you can query for the structure of the table, query for the
primary key information, etc, etc, and you can get it in two tables (and
then comparing the values in the two tables is much easier than comparing
object trees which are disparate).

If you do this, you are going to be looking at the sysobjects,
sysindexes, and sysindexkeys table primarily.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top