A good article to start with is here:
http://www.sqljunkies.com/Tutorial/1...CA1D8C97D.scuk
Use the object browser to scan through the tree of objects.
Basically, once you connect to a server, you get access to the .Databases
collection. Find the database that you are interested in by name (as
illustrated in the example) or just scan the collection and get the name of
each database. Once inside a database, open the Tables collection and find
the table of interest.
Once you have found the table, you can compare columns, datatypes,
dependencies, etc using the object model, or you can script the whole thing
to ASCII and compare the output.
Another good article, that examines DMO from the underlying technology is:
http://www.expresscomputeronline.com...chspace1.shtml
A much older article, but still useful, is:
http://www.ftponline.com/vsm/2001_12...efault_pf.aspx
Be aware that SQL Server Yukon is replacing SQL DMO with SQL Management
Objects, a native .NET object model that is somewhat dissimilar to SQL DMO.
I do not know if SQL DMO will be compatible with SMO (it probably is), but I
suspect that SQL DMO will not ship natively with Yukon. In that case, your
app may not run if the server that you are running it on doesn't have SQL
Server 2000 installed.
Good Luck,
--- Nick
"Stephen" <St*****@discussions.microsoft.com> wrote in message
news:F9**********************************@microsof t.com...
I am trying to compare the tables in two similar environments 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