SQLDMO object help needed please

G

Guest

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
 
N

Nick Malik

A good article to start with is here:
http://www.sqljunkies.com/Tutorial/1BFBD444-DCB2-4318-A315-56BCA1D8C97D.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/20030616/techspace1.shtml

A much older article, but still useful, is:
http://www.ftponline.com/vsm/2001_12/magazine/features/fbalena/default_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
 
N

Nick Malik

I retract one of my statements... apparently SQL DMO will ship with Yukon.

--- Nick
 

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