Monday, March 19, 2012

Compare SQL objects

Is there a stored procedure to allow me to compare two
SQL objects? In my case for example I want to compare
two stored procedures on two different databases?

If there is no SP that does comparison, would there be
any code in SQL DMO that does this?

How does someone learn SQL DMO? Does SQL Server
2000 have by default DMO learning material or I have to
search for books?

Thank youHi

You can try scripting them using DMO and then doing a file compare on the
two files.

Other options are Redgate compare:
http://www.red-gate.com/sql/summary.htm

OR QALite:
http://www.rac4sql.net/qalite_main.asp

John

"serge" <sergea@.nospam.ehmail.com> wrote in message
news:AtHje.74139$JU3.1442129@.wagner.videotron.net. ..
> Is there a stored procedure to allow me to compare two
> SQL objects? In my case for example I want to compare
> two stored procedures on two different databases?
> If there is no SP that does comparison, would there be
> any code in SQL DMO that does this?
> How does someone learn SQL DMO? Does SQL Server
> 2000 have by default DMO learning material or I have to
> search for books?
>
> Thank you|||"serge" <sergea@.nospam.ehmail.com> wrote in message
news:AtHje.74139$JU3.1442129@.wagner.videotron.net. ..
> Is there a stored procedure to allow me to compare two
> SQL objects? In my case for example I want to compare
> two stored procedures on two different databases?
> If there is no SP that does comparison, would there be
> any code in SQL DMO that does this?
> How does someone learn SQL DMO? Does SQL Server
> 2000 have by default DMO learning material or I have to
> search for books?
>
> Thank you

As John suggested, you can use the DMO Script method and compare the output.
This should be fine for procs, but it can be a problem for tables, because
you may have constraints which have been assigned a name by the system - the
constraint definition is identical, but it will show up as a difference in
your diff. You may or may not regard this as a problem, but tools such as
the Red Gate one allow you to configure your comparison to take this into
account, as well as whether or not to compare indexes, if a comparison
should be case-sensitive etc.

As for learning SQL-DMO - Books Online and practice. If you're already
familiar with COM programming, that would be useful, but it's far from
essential. Unfortunately the Books Online documentation doesn't provide many
examples - it tends to describe the steps to follow for a certain task, but
doesn't also give an actual code sample. Even if you want to use SQL-DMO
from a compiled language like VB or C#, I suggest you consider also using a
language such as Perl or Python - it's usually much faster for quick tests
and ad hoc experiments.

Simon|||There is another software tool that compares and synchronises databases
called DB Ghost (www.dbghost.com)
and it does data as well as schema. It is also the foundation for a
SQL Server change management process that works in harmony with any
source control/configuration management system to provide a completely
scalable solution for any size development team that has to work on the
same schema at the same time.

I highly recommend you check it out.

No comments:

Post a Comment